Repository navigation
fix(chat): keep code block actions from covering unlabeled code - #49582
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
In chat, a code block with no language label shows its "wrap lines" and "copy" buttons over its top-right corner. Long lines ran underneath those buttons, so you couldn't read the end of the line. Now that corner is kept clear, and the code still scrolls sideways.
What Changed
pr-16, but in a horizontally scrolling<pre>overflowing text scrolls through the padding, so it still sat under the buttons.<pre>reserves a right margin (mr-17, 68px) plus a small right padding (pr-1.5). Its scroll area now stops before the buttons, so text never goes under them, whether it scrolls or wraps. The buttons stay in the corner, 24px each, and their inset changes from 8px to 6px (right-1.5 top-1.5).Why
The approved design keeps the buttons in the corner and reserves space for them, so short blocks don't gain a header row. A margin is used instead of padding because only a margin moves where the scroll area clips. Checked against how comparable products handle this.
Linked Issue
N/A (maintainer UX fix)
Visual Proof
Component fixtures. The buttons are revealed with focus, since the shots can't hover.
Testing
pnpm fixtures:shot 'native-chat/markdown/code/NativeChatCodeBlock:*' --theme both: every variant, both themes, wide, narrow, long unbroken path, wrap on and off)pnpm check:changedpasses.Performance
None, because this only changes static CSS classes on one element.
Risk
The only visible tradeoff is in unlabeled code blocks: the horizontal scrollbar now ends 68px before the right edge, and wrapped lines are 68px narrower. Labeled and HTML blocks are unaffected. Back it out with a plain revert.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
Renderer CSS only. Mobile already shows these buttons in a header row. The fix is the same on every platform and on remote hosts.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)