From 6e04bf8e593a94d2fbba9291175b65b7dda091ca Mon Sep 17 00:00:00 2001 From: David Metcalfe <80915+DavidMetcalfe@users.noreply.github.com> Date: Mon, 14 Sep 2026 17:50:07 -0700 Subject: [PATCH] fix(desktop): keep the code-block copy control clear of the scrollbar The fenced code card's scroller (CodeCardBody / ExpandableBlock) carries `.scrollbar-overlay`, which hands the card's right edge back to the platform's ~15-17px scrollbar lane. The hover copy control sat at a 6px inset with a 10px icon, inside that lane and on top of the bar itself. Inset it 16px and use the 12px icon the other corner copy controls use (log-tail.tsx). Salvaged from #110548 without its className change-detector test; the fix is pure CSS (Tailwind inset/icon size) and is verified by a static trace against the .scrollbar-overlay scroller. --- .../src/components/chat/shiki-highlighter.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/components/chat/shiki-highlighter.tsx b/apps/desktop/src/components/chat/shiki-highlighter.tsx index 0e285f1048..d19f56e733 100644 --- a/apps/desktop/src/components/chat/shiki-highlighter.tsx +++ b/apps/desktop/src/components/chat/shiki-highlighter.tsx @@ -22,6 +22,17 @@ export { SHIKI_COLOR_REPLACEMENTS, SHIKI_THEME } from '@/components/chat/shiki-c * background-only — no header row, no language label — so a fence reads as a * tinted slab of the reply; copy is a hover-reveal control in the corner. * + * That control is inset 16px rather than hugging the corner: the card's + * scroller spans its full width, so the card's right edge IS the scrollbar's + * lane, and `.scrollbar-overlay` on that scroller hands the lane back to the + * platform (~15px macOS classic with a mouse attached, ~17px Windows) rather + * than the app's themed 4px gutter. The old 6px inset sat on the bar it + * floats over, at the height the thumb occupies when scrolled to the top. + * 16px clears macOS's ~15px lane with the control's outer box and puts the + * 12px icon 20px out (via `px-1`), clearing Windows's ~17px lane. Same + * treatment as the tool-block copy button (tool/fallback.tsx), which floats + * over the same kind of scroller. + * * The heavy lifting lives in the lazy `shiki-block` chunk (full bundle so all * `bundledLanguages` work; theme switches follow the document `color-scheme` * via `defaultColor="light-dark()"`), and its output is cached by content so @@ -142,8 +153,8 @@ export const SyntaxHighlighter: FC = ({