Keep long chat messages within a stable layout
The code needs its line structure, while surrounding prose needs a readable column. A nested scroll region can serve both goals.
Start here
This example uses the sample details below. Replace them with your own facts before applying the instructions.
- Code sample has long lines; narrow phone view.
Start with the facts
Code sample has long lines; narrow phone view. Keep a small reproducible example and the expected behavior. Remove secrets from the code or error message before requesting help.
Spot the problem
The wording or action to avoid is: “Let the code block expand the entire page width.” The code needs its line structure, while surrounding prose needs a readable column. A nested scroll region can serve both goals.
Make the correction
Keep the message column constrained and allow code blocks to scroll horizontally within their own area.
Check before using the result
Test narrow widths and browser zoom with a long code line and confirm that the composer and navigation remain reachable.
Worked example and reusable input
Use the stated inputs to reproduce checked local outputs. Replace sample facts when applying a brief to your own work.
TASK Keep long chat messages within a stable layout SAMPLE INPUT — replace with your actual facts Code sample has long lines; narrow phone view. AVOID Let the code block expand the entire page width. CORRECTED APPROACH Keep the message column constrained and allow code blocks to scroll horizontally within their own area. ACCEPTANCE CHECK Test narrow widths and browser zoom with a long code line and confirm that the composer and navigation remain reachable.
Key takeaways
- The code needs its line structure, while surrounding prose needs a readable column. A nested scroll region can serve both goals.
- Test narrow widths and browser zoom with a long code line and confirm that the composer and navigation remain reachable.