You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Chat - Copy to clipboard icon is appearing over the code block text #94868
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 15:40:07 UTC.
Proposal
What is the root cause of that problem?
This is a regression from the new "copy code block on hover" feature, merged in PR #94337 (d20274a295d, June 23) — which is why it reproduces in staging but not production.
When a code block is hovered, PreRenderer renders a CopyTextToClipboard button that is absolutely positioned over the top‑right corner of the block:
// Single-line code blocks keep the copy button tight to the corner.
codeBlockCopyButtonWrapper: {
position: 'absolute',
top: 4,
right: 4,
},
// Multi-line code blocks get extra breathing room around the copy button.
codeBlockCopyButtonWrapperMultiline: {
position: 'absolute',
top: 8,
right: 8,
},
The problem is the geometry of the block underneath it. A <pre> is content‑sized — it uses whiteSpace: 'pre' with no width, and only paddingHorizontal: 12:
So the bordered box shrinks to fit its text, and no horizontal gutter is reserved for the button. The 28px button (which carries its own solid background via shouldUseButtonBackground) is pinned 4px from the block's right edge, i.e. on top of the last characters of the code. For a short single‑line block like the repro's test, the block is only ~24px of padding plus the text width, so the button lands squarely over the text and hides it.
So: content‑sized <pre> (no reserved right gutter) → an absolutely‑positioned 28px copy button pinned to the block's right edge → the button's background covers the code text on hover, worst on short single‑line blocks.
What changes do you think we should make in order to solve the problem?
Reserve a right‑hand gutter inside the code block equal to the copy‑button footprint, so the text never renders underneath the button. Because the gutter is permanent (not hover‑gated), there is also no layout shift when the button fades in — which is exactly why the button was made absolute in the first place.
The block style is already passed straight into the <pre> renderer (the task‑title branch already does this via style={styles.taskTitleMenuItem}), so the smallest change is to pass a style that adds the gutter to the normal render path:
This pushes the code text left so the absolutely‑positioned button sits over empty padding instead of over the text, and it fixes both the single‑line and multi‑line variants at once. The exact paddingRight value (and gating it to web/desktop, since Hoverable never fires the button on native) can be finalized in the PR.
What alternative solutions did you explore? (Optional)
Move the button out of the block entirely — render it in a flexDirection: 'row' next to the <pre> instead of absolutely over it. This guarantees no overlap, but reintroduces a layout shift each time the button mounts/unmounts on hover, and complicates wrapping on narrow screens. Reserving an internal gutter is fewer lines, keeps the existing absolute‑positioning (no hover jump), and fixes the root cause directly.
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 16:50:00 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On web, hovering a chat message that contains a triple-backtick code block shows the copy-to-clipboard button directly over the rendered code text. This is most visible for a short single-line block like test, where the 28px copy button can cover most or all of the code.
What is the root cause of that problem?
This is a regression from the recently added code-block copy affordance in PR #94337. PreRenderer extracts the raw code text with getCodeBlockText(), detects whether the block is single-line or multi-line, and renders CopyTextToClipboard as an absolutely positioned hover-only button:
The copy button is placed at the top-right of the code block with right: 4 for single-line blocks and right: 8 for multi-line blocks, and the button itself is 28px wide:
// Single-line code blocks keep the copy button tight to the corner.
codeBlockCopyButtonWrapper: {
position: 'absolute',
top: 4,
right: 4,
},
// Multi-line code blocks get extra breathing room around the copy button.
codeBlockCopyButtonWrapperMultiline: {
position: 'absolute',
top: 8,
right: 8,
},
The underlying <pre> block is content-sized and only has the normal code-block horizontal padding. It does not reserve any right-side gutter for the hover button:
So the button is painted over the code text instead of over empty space. For a short block such as test, the code block width is only the text plus its normal padding, which leaves no room for the button.
This is separate from intentional copy surfaces such as CopyTextRenderer / the copy-text renderer. Those dedicated copy affordances should remain untouched and continue to work. The issue is specifically the geometry of the hover copy button rendered by the generic <pre> renderer for chat code blocks.
What changes do you think we should make in order to solve the problem?
Keep the code-block copy affordance from PR #94337, but reserve space for it inside the rendered <pre> block when the button is shown. In PreRenderer, preserve the existing CopyTextToClipboard hover behavior and pass an additional right-gutter style to TDefaultRenderer only when the code block has copyable text and is hovered.
The important detail is that this style must be merged with the existing renderer style, not replace it. Replacing the style can strip the normal <pre> background, border, font, and padding, making the block look different from staging. Merging the existing style with a small right-gutter style keeps the regular code-block appearance while ensuring the copy button sits over reserved padding instead of over the text.
Add a shared style such as codeBlockWithCopyButtonGutter with enough paddingRight to clear the 28px button plus its right inset and a small gap. Keep the existing single-line and multi-line button wrapper styles, keep getCodeBlockText() and its tests, and leave CopyTextRenderer / copy-text untouched.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Render a single-line chat code block such as test, hover it, and verify the copy button is still shown but no longer overlaps the code text.
Verify the hovered code block keeps the normal <pre> background/border styling while adding only the reserved right-side gutter.
Render the same code block without hover and verify its normal non-hover appearance is unchanged.
Cover a multi-line code block to ensure the copy button also sits over reserved padding there.
Verify intentional copy surfaces that use CopyTextRenderer / copy-text still render their copy affordance.
What alternative solutions did you explore? (Optional)
Removing the copy button entirely would stop the overlap, but it would also remove the feature intentionally added in PR #94337 for all fenced chat code blocks. Moving the button outside the code block would avoid overlap too, but it changes the layout more significantly and can introduce hover-time layout shifts. Reserving an internal gutter is the smallest fix: the button remains available, the normal code-block UI remains intact, and the text no longer renders underneath the button.
Please re-state the problem that we are trying to solve in this issue.
On Web, hovering a code-block message can position the copy-to-clipboard action over the code text.
What is the root cause of that problem?
In src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx, showContextMenu() assigns position.vertical to contextMenuDimensions.current.width when measuring an overflow-menu anchor. This stores a screen coordinate instead of the anchor width, so overflow positioning uses invalid dimensions and can place the menu over the code block.
What changes do you think we should make in order to solve the problem?
Update showContextMenu() to set contextMenuDimensions.current with width: position.width and height: position.height. Add a focused test covering overflow-menu anchor dimensions and placement for a short code-block message.
What alternative solutions did you explore? (Optional)
Special-casing code blocks or hiding the copy action would mask the symptom; correcting the invalid anchor width fixes the shared positioning logic.
changed the title [-]Chat - Copy to clipboard icon is appearing over the code block text[/-][+][$250] Chat - Copy to clipboard icon is appearing over the code block text[/+]on Jun 29, 2026
The local evidence matches this recurring failure shape: the composer visibility gate and recipient lookup are derived from different Onyx selector states. Here, src/pages/inbox/report/actionContents/ChatMessageContent.tsx:76 and src/pages/inbox/report/SystemChatReportFooterMessage.tsx:21 do not agree on the same test value, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.
What changes do you think we should make in order to solve the problem?
Update src/pages/inbox/report/actionContents/ChatMessageContent.tsx:76 to derive test from the report/transaction source that owns this flow before the value is consumed.
Carry the same normalized value through src/pages/inbox/report/SystemChatReportFooterMessage.tsx:21; that follows the safer family move to derive the recipient accountID once, then let both the eligibility selector and recipient selector use that same ID, so the write/optimistic/read paths agree instead of only changing the visible component.
Keep the change inside the Chat Report, Composer, Recipient Local Time surface and avoid changing chat composer rendering, Onyx selector churn.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Add or update a regression in tests/unit/ComposerLocalTimeTest.tsx for the exact issue flow: Chat - Copy to clipboard icon is appearing over the code block text.
Cover the counter-case near src/pages/inbox/report/actionContents/ChatMessageContent.tsx:76 so valid existing test behavior still works.
Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.
What alternative solutions did you explore? (Optional)
I would not add a broad new condition outside these referenced paths; the safer fix is to keep test consistent at the first read/write boundary shown above.
Note: This proposal is not a duplicate. It identifies a deeper root cause rather than the surface symptom.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web (Chrome), when a user hovers a chat message containing a code block, the copy-to-clipboard icon appears overlapping the code block's text content. Expected behavior: the icon should be visible alongside the code block without covering any of the rendered code.
What is the root cause of that problem?
PR #94337 added an absolutely-positioned copy button overlay in src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx:85-86 using styles.codeBlockCopyButtonWrapper / codeBlockCopyButtonWrapperMultiline defined in src/styles/index.ts:6137-6147. Both wrapper styles use position: 'absolute' with top: 4/8 and right: 4/8, placed as a sibling of the <PressableWithoutFeedback> that renders <Text> containing the code (inside the same parent <View>). The code block itself was never given any top/right padding (or a reserved icon slot) to accommodate the 28×28 copyableTextFieldButton (src/styles/index.ts:6129-6135), so the absolute icon paints directly on top of the first line of code — exactly the symptom for the single-line \``test```` repro where the icon overlaps the word "test".
What changes do you think we should make in order to solve the problem?
src/styles/index.ts:6137-6147 — give the code block's inner container reserved space for the copy button (e.g., add paddingRight of ~36 and paddingTop of ~4/8 to the code text wrapper, or shift the existing pre/code padding styles to leave room at the top-right) so the absolute icon never overlaps text.
src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx:78-94 — wrap the inner <Text>/<TDefaultRenderer> block in a <View> that applies the reserved padding above, ensuring single-line code blocks (height ≈ one line) push the rendered text left of the icon rather than under it.
Alternatively, keep the icon hidden until hover AND render it outside the code block bounds (e.g., absolutely positioned with top: -X or in a row layout next to the block) so it never sits on top of code regardless of code-block height.
Verify single-line and multi-line cases both look correct (single-line is the regressing case in this issue; the multiline wrapper has slightly larger offsets but still overlaps short code).
What alternative solutions did you explore? (Optional)
Render the copy button in a sticky/floating toolbar above the code block on hover instead of overlaying it, mirroring common code-block UX (GitHub, VS Code Web).
Please re-state the problem that we are trying to solve in this issue.
On web, hovering a sent code‑block message (e.g. a triple‑backtick ```test```) shows the copy‑to‑clipboard icon directly on top of the code text, hiding it. Worst case is a short single‑line block where the icon covers the entire content.
What is the root cause of that problem?
This is a regression from the "copy code block on hover" feature added in PR #94337 (staging only, hence not reproducible in production).
On hover, PreRenderer renders a CopyTextToClipboard button as an absolutely‑positioned overlay pinned to the block's top‑right corner:
The wrappers pin it at right: 4 (single‑line) / right: 8 (multi‑line), and the button is a solid 28×28 (it carries its own background via shouldUseButtonBackground):
// Single-line code blocks keep the copy button tight to the corner.
codeBlockCopyButtonWrapper: {
position: 'absolute',
top: 4,
right: 4,
},
// Multi-line code blocks get extra breathing room around the copy button.
codeBlockCopyButtonWrapperMultiline: {
position: 'absolute',
top: 8,
right: 8,
},
The problem is the geometry of the block underneath. A <pre> is content‑sized — it has only paddingHorizontal: 12 and reserves no horizontal room on the right:
So the bordered box shrinks to fit its text, and the box's right edge falls right after the last character. The opaque 28px button pinned 4px from that edge therefore always paints over the trailing code, and for a short single‑line block the trailing code is the whole message — so the icon hides test entirely.
What changes do you think we should make in order to solve the problem?
The overlay design from #94337 is intentional, so I'd keep the button where it is and instead reserve a right‑hand gutter on the <pre> so the text never renders under the button. The button only ever appears on hover (and only on hover‑capable platforms — Hoverable never fires on native), so the gutter should be reserved on the same isHovered condition, not permanently. This keeps every code block visually unchanged at rest and on native, and the reserved space opens up exactly when the button fades in.
The inner TDefaultRenderer is what renders the bordered <pre> box, and it already accepts a style prop (the task‑title branch passes one). So I'd pass a hover‑gated gutter style to it:
with a new shared style sized to clear the button (button 28px + its right inset + a small gap, on top of the existing 12px padding):
codeBlockHoverGutter: {paddingRight: 40,},
This pushes the code text left only while hovered, so the absolutely‑positioned button lands over the reserved padding instead of over the code, fixing both the single‑line and multi‑line cases. The exact paddingRight (and, if we want to mirror the two wrapper insets, sizing it per isMultilineCodeBlock) can be finalized in the PR.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Render a single‑line code‑block comment, simulate hover, and assert the copy button (CopyTextToClipboard-CopyButton) renders and the <pre> receives the reserved gutter style so the text is not under the button.
Same for a multi‑line code block.
Assert that with no hover (and on native, where Hoverable reports no hover) no gutter is applied, so the block renders exactly as before.
What alternative solutions did you explore? (Optional)
Reserve the gutter permanently (apply paddingRight to the <pre> unconditionally). This is simpler and avoids any hover‑time motion, but it leaves every code block — including non‑hovered blocks and native, where the button never shows — with a permanently lopsided empty gutter on the right. Gating the gutter to isHovered matches the button's own visibility and avoids that.
Move the button into a flexDirection: 'row' next to the <pre>. This guarantees no overlap, but reintroduces a vertical/wrapping layout shift on hover and complicates narrow screens — the absolute overlay from Add one-click copy button to code blocks in chat #94337 exists specifically to avoid that.
Remove the copy button from chat code blocks. This "fixes" the overlap by deleting the feature Add one-click copy button to code blocks in chat #94337 deliberately shipped for all fenced code blocks, so it isn't the right resolution.
⚠️ @dilshodmackbook-sketch Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
⚠️@KJ21-ENG Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
This was false flag, my proposal was already as per the tamplate but i think it got flagged due to having this '' hidde scaffolding from template. I have alreday removed it and informed here as well.
@huult I updated my proposal after local validation and checking the surrounding proposals/context. The important finding after the initial implementation attempt is that removing the copy icon entirely is over-broad: PR #94337 intentionally added this copy affordance for fenced chat code blocks, so the bug is not the existence of the icon itself. The actual RCA is that the PR #94337 hover copy button is absolutely positioned over a content-sized <pre> with no reserved right-side space, which is why it covers short code like test.
So the fix direction was updated too: keep the code-block copy affordance, leave CopyTextRenderer / copy-text untouched, and merge a small right gutter into the existing <pre> style on hover. That keeps the normal code-block styling intact while making the icon sit over padding instead of text.
⚠️@abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
What alternative solutions did you explore? (Optional)
N/A
Result
Before
|
After
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
⚠️@PiyushChandra17 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Please re-state the problem that we are trying to solve in this issue.
When hovering over a chat message that contains a code block, the "Copy to clipboard" icon is rendered on top of the code block text instead of sitting in empty space. For single-line / short code blocks this causes the icon to overlap and cover the last characters of the code.
What is the root cause of that problem?
The copy button shown on hover is an absolutely-positioned overlay placed in the top-right corner of the code block, but no horizontal space is reserved for it, so it sits directly over the code text.
In PreRenderer, when the block is hovered the copy button is rendered inside a wrapper that is absolutely positioned at the top-right corner of the code block container:
The copy button is 28px wide (copyableTextFieldButton) and is offset 4–8px from the right edge, so its footprint (~32–36px) extends well past the 12px of right padding and lands on top of the actual code characters. For a short single-line block such as test, there is no free space at the top-right, so the icon visibly covers the code text.
What changes do you think we should make in order to solve the problem?
Reserve horizontal space at the top-right of the code block for the copy button while it is displayed, so the icon occupies cleared space instead of overlapping the code text.
In PreRenderer, when the copy button is shown (block hovered and codeText present), apply additional right padding to the code block content equal to the copy button's footprint. Because the button uses two offsets (single-line vs multiline), the reserved padding should match each case:
Concretely, pass an extra right-padding style to the code block content (the <TDefaultRenderer> / surrounding Text container) only while the button is visible, and add two small style entries in src/styles/index.ts (e.g. codeBlockWithCopyButtonPadding / ...Multiline) holding the corresponding paddingRight values. The padding is applied alongside the existing isHovered && !!codeText condition that already gates the button, so the layout only reserves space exactly when the icon appears. This keeps the icon in the top-right corner over reserved empty space and guarantees it never sits over the code text, for both single-line and multiline blocks.
What alternative solutions did you explore? (Optional)
Permanently reserve the right padding for every code block (not only on hover). This removes the on-hover reflow but leaves a visible empty gap on the right of every code block even when the button is not shown, which looks unintentional for short blocks.
Render the copy button beside the code block (outside its bounds) rather than as an overlay. This avoids overlap entirely but changes the established top-right corner placement and behaves inconsistently between content-width single-line blocks and full-width multiline blocks.
⚠️@wildan-m Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Hover over the rendered code block and verify a copy icon button appears at the top-right (4px from top/right).
Screen.Recording.2026-06-30.at.10.19.03.mov
@Expensify/design @shawnborton This issue was introduced in #94337, and the current behavior appears to be expected. However, with shorter text, it still feels like a bug. Could you review this case and let me know whether we should keep the current behavior or make a change?
If we change it to address this ticket, I think there are a couple of improvements we could make:
Format the code text more like GitHub, as shown in the example below.
test
Add some spacing for the copy-to-clipboard icon, as shown in the video below.
Activity
applause-bot commentedon Jun 29, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/1a6fa36125cff106d7cf99e069ec097301b4fce58628a01f4b8c2eb5361a9fef
yusufdeveloper2903 commentedon Jun 29, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 15:40:07 UTC.
Proposal
What is the root cause of that problem?
This is a regression from the new "copy code block on hover" feature, merged in PR #94337 (
d20274a295d, June 23) — which is why it reproduces in staging but not production.When a code block is hovered,
PreRendererrenders aCopyTextToClipboardbutton that is absolutely positioned over the top‑right corner of the block:App/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx
Lines 85 to 95 in 05d32d5
The wrapper styles place it at
right: 4(single‑line) /right: 8(multi‑line), and the button itself is28×28:App/src/styles/index.ts
Lines 6129 to 6147 in 05d32d5
The problem is the geometry of the block underneath it. A
<pre>is content‑sized — it useswhiteSpace: 'pre'with no width, and onlypaddingHorizontal: 12:App/src/styles/index.ts
Lines 210 to 218 in 05d32d5
So the bordered box shrinks to fit its text, and no horizontal gutter is reserved for the button. The
28pxbutton (which carries its own solid background viashouldUseButtonBackground) is pinned4pxfrom the block's right edge, i.e. on top of the last characters of the code. For a short single‑line block like the repro'stest, the block is only ~24pxof padding plus the text width, so the button lands squarely over the text and hides it.So: content‑sized
<pre>(no reserved right gutter) → an absolutely‑positioned28pxcopy button pinned to the block's right edge → the button's background covers the code text on hover, worst on short single‑line blocks.What changes do you think we should make in order to solve the problem?
Reserve a right‑hand gutter inside the code block equal to the copy‑button footprint, so the text never renders underneath the button. Because the gutter is permanent (not hover‑gated), there is also no layout shift when the button fades in — which is exactly why the button was made absolute in the first place.
The block style is already passed straight into the
<pre>renderer (the task‑title branch already does this viastyle={styles.taskTitleMenuItem}), so the smallest change is to pass a style that adds the gutter to the normal render path:with a new shared style sized to clear the button (button
28px+ itsrightinset + a small gap, on top of the existing12pxpadding):This pushes the code text left so the absolutely‑positioned button sits over empty padding instead of over the text, and it fixes both the single‑line and multi‑line variants at once. The exact
paddingRightvalue (and gating it toweb/desktop, sinceHoverablenever fires the button on native) can be finalized in the PR.What alternative solutions did you explore? (Optional)
Move the button out of the block entirely — render it in a
flexDirection: 'row'next to the<pre>instead of absolutely over it. This guarantees no overlap, but reintroduces a layout shift each time the button mounts/unmounts on hover, and complicates wrapping on narrow screens. Reserving an internal gutter is fewer lines, keeps the existing absolute‑positioning (no hover jump), and fixes the root cause directly.KJ21-ENG commentedon Jun 29, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 16:50:00 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On web, hovering a chat message that contains a triple-backtick code block shows the copy-to-clipboard button directly over the rendered code text. This is most visible for a short single-line block like
test, where the 28px copy button can cover most or all of the code.What is the root cause of that problem?
This is a regression from the recently added code-block copy affordance in PR #94337.
PreRendererextracts the raw code text withgetCodeBlockText(), detects whether the block is single-line or multi-line, and rendersCopyTextToClipboardas an absolutely positioned hover-only button:App/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx
Lines 44 to 95 in 50ff928
The copy button is placed at the top-right of the code block with
right: 4for single-line blocks andright: 8for multi-line blocks, and the button itself is 28px wide:App/src/styles/index.ts
Lines 6129 to 6147 in 50ff928
The underlying
<pre>block is content-sized and only has the normal code-block horizontal padding. It does not reserve any right-side gutter for the hover button:App/src/styles/index.ts
Lines 210 to 218 in 50ff928
So the button is painted over the code text instead of over empty space. For a short block such as
test, the code block width is only the text plus its normal padding, which leaves no room for the button.This is separate from intentional copy surfaces such as
CopyTextRenderer/ thecopy-textrenderer. Those dedicated copy affordances should remain untouched and continue to work. The issue is specifically the geometry of the hover copy button rendered by the generic<pre>renderer for chat code blocks.What changes do you think we should make in order to solve the problem?
Keep the code-block copy affordance from PR #94337, but reserve space for it inside the rendered
<pre>block when the button is shown. InPreRenderer, preserve the existingCopyTextToClipboardhover behavior and pass an additional right-gutter style toTDefaultRendereronly when the code block has copyable text and is hovered.The important detail is that this style must be merged with the existing renderer style, not replace it. Replacing the style can strip the normal
<pre>background, border, font, and padding, making the block look different from staging. Merging the existing style with a small right-gutter style keeps the regular code-block appearance while ensuring the copy button sits over reserved padding instead of over the text.Add a shared style such as
codeBlockWithCopyButtonGutterwith enoughpaddingRightto clear the 28px button plus its right inset and a small gap. Keep the existing single-line and multi-line button wrapper styles, keepgetCodeBlockText()and its tests, and leaveCopyTextRenderer/copy-textuntouched.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
test, hover it, and verify the copy button is still shown but no longer overlaps the code text.<pre>background/border styling while adding only the reserved right-side gutter.CopyTextRenderer/copy-textstill render their copy affordance.What alternative solutions did you explore? (Optional)
Removing the copy button entirely would stop the overlap, but it would also remove the feature intentionally added in PR #94337 for all fenced chat code blocks. Moving the button outside the code block would avoid overlap too, but it changes the layout more significantly and can introduce hover-time layout shifts. Reserving an internal gutter is the smallest fix: the button remains available, the normal code-block UI remains intact, and the text no longer renders underneath the button.
melvin-bot commentedon Jun 29, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @huult (
External)kitvasyl commentedon Jun 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web, hovering a code-block message can position the copy-to-clipboard action over the code text.
What is the root cause of that problem?
In
src/pages/inbox/report/ContextMenu/PopoverReportActionContextMenu.tsx,showContextMenu()assignsposition.verticaltocontextMenuDimensions.current.widthwhen measuring an overflow-menu anchor. This stores a screen coordinate instead of the anchor width, so overflow positioning uses invalid dimensions and can place the menu over the code block.What changes do you think we should make in order to solve the problem?
Update
showContextMenu()to setcontextMenuDimensions.currentwithwidth: position.widthandheight: position.height. Add a focused test covering overflow-menu anchor dimensions and placement for a short code-block message.What alternative solutions did you explore? (Optional)
Special-casing code blocks or hiding the copy action would mask the symptom; correcting the invalid anchor width fixes the shared positioning logic.
[-]Chat - Copy to clipboard icon is appearing over the code block text[/-][+][$250] Chat - Copy to clipboard icon is appearing over the code block text[/+]melvin-bot commentedon Jun 29, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022071618985775572458
godzillaxbox19982014-lgtm commentedon Jun 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Chat - Copy to clipboard icon is appearing over the code block text
What is the root cause of that problem?
I traced this to the path that handles
test:ChatMessageContent):<View style={displayAsGroup && hasBeenFlagged ? styles.blockquote : {}}>expensifyIcons):const expensifyIcons = useMemoizedLazyExpensifyIcons(['Lightbulb']);SystemChatReportFooterMessage):shouldShowIconsrc/pages/inbox/report/actionContents/ChatMessageContent.tsx:76andsrc/pages/inbox/report/SystemChatReportFooterMessage.tsx:21do not agree on the sametestvalue, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.What changes do you think we should make in order to solve the problem?
src/pages/inbox/report/actionContents/ChatMessageContent.tsx:76to derivetestfrom the report/transaction source that owns this flow before the value is consumed.src/pages/inbox/report/SystemChatReportFooterMessage.tsx:21; that follows the safer family move to derive the recipient accountID once, then let both the eligibility selector and recipient selector use that same ID, so the write/optimistic/read paths agree instead of only changing the visible component.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
tests/unit/ComposerLocalTimeTest.tsxfor the exact issue flow: Chat - Copy to clipboard icon is appearing over the code block text.src/pages/inbox/report/actionContents/ChatMessageContent.tsx:76so valid existingtestbehavior still works.What alternative solutions did you explore? (Optional)
testconsistent at the first read/write boundary shown above.aswin-s commentedon Jun 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web (Chrome), when a user hovers a chat message containing a code block, the copy-to-clipboard icon appears overlapping the code block's text content. Expected behavior: the icon should be visible alongside the code block without covering any of the rendered code.
What is the root cause of that problem?
PR #94337 added an absolutely-positioned copy button overlay in
src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx:85-86usingstyles.codeBlockCopyButtonWrapper/codeBlockCopyButtonWrapperMultilinedefined insrc/styles/index.ts:6137-6147. Both wrapper styles useposition: 'absolute'withtop: 4/8andright: 4/8, placed as a sibling of the<PressableWithoutFeedback>that renders<Text>containing the code (inside the same parent<View>). The code block itself was never given any top/right padding (or a reserved icon slot) to accommodate the 28×28copyableTextFieldButton(src/styles/index.ts:6129-6135), so the absolute icon paints directly on top of the first line of code — exactly the symptom for the single-line\``test```` repro where the icon overlaps the word "test".What changes do you think we should make in order to solve the problem?
src/styles/index.ts:6137-6147— give the code block's inner container reserved space for the copy button (e.g., addpaddingRightof~36andpaddingTopof~4/8to the code text wrapper, or shift the existing pre/code padding styles to leave room at the top-right) so the absolute icon never overlaps text.src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx:78-94— wrap the inner<Text>/<TDefaultRenderer>block in a<View>that applies the reserved padding above, ensuring single-line code blocks (height ≈ one line) push the rendered text left of the icon rather than under it.top: -Xor in a row layout next to the block) so it never sits on top of code regardless of code-block height.What alternative solutions did you explore? (Optional)
Render the copy button in a sticky/floating toolbar above the code block on hover instead of overlaying it, mirroring common code-block UX (GitHub, VS Code Web).
7 remaining items
David-2002065 commentedon Jun 29, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On web, hovering a sent code‑block message (e.g. a triple‑backtick
```test```) shows the copy‑to‑clipboard icon directly on top of the code text, hiding it. Worst case is a short single‑line block where the icon covers the entire content.What is the root cause of that problem?
This is a regression from the "copy code block on hover" feature added in PR #94337 (staging only, hence not reproducible in production).
On hover,
PreRendererrenders aCopyTextToClipboardbutton as an absolutely‑positioned overlay pinned to the block's top‑right corner:App/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx
Lines 85 to 95 in 50ff928
The wrappers pin it at
right: 4(single‑line) /right: 8(multi‑line), and the button is a solid28×28(it carries its own background viashouldUseButtonBackground):App/src/styles/index.ts
Lines 6129 to 6147 in 50ff928
The problem is the geometry of the block underneath. A
<pre>is content‑sized — it has onlypaddingHorizontal: 12and reserves no horizontal room on the right:App/src/styles/index.ts
Lines 210 to 218 in 50ff928
So the bordered box shrinks to fit its text, and the box's right edge falls right after the last character. The opaque
28pxbutton pinned4pxfrom that edge therefore always paints over the trailing code, and for a short single‑line block the trailing code is the whole message — so the icon hidestestentirely.What changes do you think we should make in order to solve the problem?
The overlay design from #94337 is intentional, so I'd keep the button where it is and instead reserve a right‑hand gutter on the
<pre>so the text never renders under the button. The button only ever appears on hover (and only on hover‑capable platforms —Hoverablenever fires on native), so the gutter should be reserved on the sameisHoveredcondition, not permanently. This keeps every code block visually unchanged at rest and on native, and the reserved space opens up exactly when the button fades in.The inner
TDefaultRendereris what renders the bordered<pre>box, and it already accepts astyleprop (the task‑title branch passes one). So I'd pass a hover‑gated gutter style to it:with a new shared style sized to clear the button (button
28px+ its right inset + a small gap, on top of the existing12pxpadding):This pushes the code text left only while hovered, so the absolutely‑positioned button lands over the reserved padding instead of over the code, fixing both the single‑line and multi‑line cases. The exact
paddingRight(and, if we want to mirror the two wrapper insets, sizing it perisMultilineCodeBlock) can be finalized in the PR.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
CopyTextToClipboard-CopyButton) renders and the<pre>receives the reserved gutter style so the text is not under the button.Hoverablereports no hover) no gutter is applied, so the block renders exactly as before.What alternative solutions did you explore? (Optional)
paddingRightto the<pre>unconditionally). This is simpler and avoids any hover‑time motion, but it leaves every code block — including non‑hovered blocks and native, where the button never shows — with a permanently lopsided empty gutter on the right. Gating the gutter toisHoveredmatches the button's own visibility and avoids that.flexDirection: 'row'next to the<pre>. This guarantees no overlap, but reintroduces a vertical/wrapping layout shift on hover and complicates narrow screens — the absolute overlay from Add one-click copy button to code blocks in chat #94337 exists specifically to avoid that.github-actions commentedon Jun 29, 2026
David-2002065 commentedon Jun 29, 2026
Proposal updated
KJ21-ENG commentedon Jun 29, 2026
This was false flag, my proposal was already as per the tamplate but i think it got flagged due to having this '' hidde scaffolding from template. I have alreday removed it and informed here as well.
@huult I updated my proposal after local validation and checking the surrounding proposals/context. The important finding after the initial implementation attempt is that removing the copy icon entirely is over-broad: PR #94337 intentionally added this copy affordance for fenced chat code blocks, so the bug is not the existence of the icon itself. The actual RCA is that the PR #94337 hover copy button is absolutely positioned over a content-sized
<pre>with no reserved right-side space, which is why it covers short code liketest.So the fix direction was updated too: keep the code-block copy affordance, leave
CopyTextRenderer/copy-textuntouched, and merge a small right gutter into the existing<pre>style on hover. That keeps the normal code-block styling intact while making the icon sit over padding instead of text.Comparison branch :- main...KJ21-ENG:KJ21-ENG/94868-codeblock-copy
POW :-
ezyZip.63.mp4
abbasifaizan70 commentedon Jun 29, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon Jun 29, 2026
PiyushChandra17 commentedon Jun 29, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-29 18:45:33 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Chat - Copy to clipboard icon is appearing over the code block text
What is the root cause of that problem?
PreRender.tsx, we are rendering thisCopyTextToClipboardcomponent within thisViewthat has style:App/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx
Line 86 in 19f1bb3
Since this is single line code block then it falls back to
styles.codeBlockCopyButtonWrapperThis
styles.codeBlockCopyButtonWrapperusesposition: absoluteApp/src/styles/index.ts
Lines 6137 to 6141 in 19f1bb3
<pre>tag itself only reserves a flat symmetric paddingWhat changes do you think we should make in order to solve the problem?
<pre>box so there's enough room for the icon regardless of how short the snippet is hereApp/src/styles/index.ts
Lines 210 to 218 in 19f1bb3
pre: { ...baseCodeTagStyles(theme), paddingVertical: 8, paddingHorizontal: 12, + paddingRight: 40, fontSize: undefined, ...FontUtils.fontFamily.platform.MONOSPACE, marginTop: 0, marginBottom: 0, },What alternative solutions did you explore? (Optional)
N/A
Result
Before
After
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
github-actions commentedon Jun 29, 2026
wildan-m commentedon Jun 30, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When hovering over a chat message that contains a code block, the "Copy to clipboard" icon is rendered on top of the code block text instead of sitting in empty space. For single-line / short code blocks this causes the icon to overlap and cover the last characters of the code.
What is the root cause of that problem?
The copy button shown on hover is an absolutely-positioned overlay placed in the top-right corner of the code block, but no horizontal space is reserved for it, so it sits directly over the code text.
In
PreRenderer, when the block is hovered the copy button is rendered inside a wrapper that is absolutely positioned at the top-right corner of the code block container:App/src/components/HTMLEngineProvider/HTMLRenderers/PreRenderer.tsx
Lines 85 to 95 in 552b726
The wrapper styles only set
position: 'absolute'with a smalltop/rightoffset; they do not push the code text out of the way:App/src/styles/index.ts
Lines 6136 to 6147 in 552b726
The code block (
pre) itself only haspaddingHorizontal: 12:App/src/styles/index.ts
Lines 210 to 218 in 552b726
The copy button is 28px wide (
copyableTextFieldButton) and is offset 4–8px from the right edge, so its footprint (~32–36px) extends well past the 12px of right padding and lands on top of the actual code characters. For a short single-line block such astest, there is no free space at the top-right, so the icon visibly covers the code text.What changes do you think we should make in order to solve the problem?
Reserve horizontal space at the top-right of the code block for the copy button while it is displayed, so the icon occupies cleared space instead of overlapping the code text.
In
PreRenderer, when the copy button is shown (block hovered andcodeTextpresent), apply additional right padding to the code block content equal to the copy button's footprint. Because the button uses two offsets (single-line vs multiline), the reserved padding should match each case:right(4) + buttonWidth(28)= ~32px,right(8) + buttonWidth(28)= ~36px.Concretely, pass an extra right-padding style to the code block content (the
<TDefaultRenderer>/ surroundingTextcontainer) only while the button is visible, and add two small style entries insrc/styles/index.ts(e.g.codeBlockWithCopyButtonPadding/...Multiline) holding the correspondingpaddingRightvalues. The padding is applied alongside the existingisHovered && !!codeTextcondition that already gates the button, so the layout only reserves space exactly when the icon appears. This keeps the icon in the top-right corner over reserved empty space and guarantees it never sits over the code text, for both single-line and multiline blocks.What alternative solutions did you explore? (Optional)
github-actions commentedon Jun 30, 2026
huult commentedon Jun 30, 2026
@MelvinBot Where is your proposal? Please create a proposal for this ticket.
huult commentedon Jun 30, 2026
Screen.Recording.2026-06-30.at.10.19.03.mov
@Expensify/design @shawnborton This issue was introduced in #94337, and the current behavior appears to be expected. However, with shorter text, it still feels like a bug. Could you review this case and let me know whether we should keep the current behavior or make a change?
If we change it to address this ticket, I think there are a couple of improvements we could make:
Screen.Recording.2026-06-30.at.10.21.14.mov
shawnborton commentedon Jun 30, 2026
Not a bug, this is working as expected. Going to close.