From 852d5ed0b30ca84ed0a2cb0c9f68c9e99aeb4252 Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Tue, 17 Nov 2026 21:28:37 -0600 Subject: [PATCH] fix(app): keep code block borders under the action fill (#64576) --- .../markdown-code-wrap.spec.ts | 20 +++++++++++++++++++ .../session-ui/src/components/markdown.css | 7 ++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/session-ui/component-tests/markdown-code-wrap.spec.ts b/packages/session-ui/component-tests/markdown-code-wrap.spec.ts index 20cd548f4bd..c96dfe7f657 100644 --- a/packages/session-ui/component-tests/markdown-code-wrap.spec.ts +++ b/packages/session-ui/component-tests/markdown-code-wrap.spec.ts @@ -72,3 +72,23 @@ story("code block actions sit in the block's top corner over the block's own bac await page.keyboard.press("Shift+Tab") await expect(toolbar(block)).toHaveCSS("opacity", "1") }) + +// The fill sits over the block's 0.5px border, and one that reaches the hairline paints over it while hovered. +story("the fill behind code block actions stays inside the block's border", async ({ mount, page }) => { + const root = await mount("current-session-code-blocks--long-lines") + const block = root.locator('[data-component="markdown-code"]').nth(2) + const toolbar = block.locator('[data-slot="markdown-code-toolbar"]') + const box = (await block.boundingBox())! + await page.mouse.move(box.x + 40, box.y + box.height / 2) + await expect(toolbar).toHaveCSS("opacity", "1") + + const fill = await toolbar.evaluate((element) => { + const bar = element.getBoundingClientRect() + const style = getComputedStyle(element, "::before") + + return { top: bar.top + parseFloat(style.top), right: bar.right - parseFloat(style.right) } + }) + + expect(fill.top - box.y).toBeGreaterThanOrEqual(1) + expect(box.x + box.width - fill.right).toBeGreaterThanOrEqual(1) +}) diff --git a/packages/session-ui/src/components/markdown.css b/packages/session-ui/src/components/markdown.css index cd734776702..c396bcb13a3 100644 --- a/packages/session-ui/src/components/markdown.css +++ b/packages/session-ui/src/components/markdown.css @@ -402,13 +402,14 @@ /* Like the shell output's Copy, the ghost buttons get the block's background behind them, so code under them doesn't show through. It fades out toward the start and the bottom, so a line it reaches softens instead of - being cut, and stops inside the block's border and rounded corner. */ + being cut. It stops a pixel inside the block's 0.5px border and rounded corner: ending flush against the + hairline paints over it once the block sits at a fractional position. */ &::before { content: ""; position: absolute; z-index: -1; - inset: -3.5px -3.5px -8px -24px; - border-start-end-radius: 5.5px; + inset: -3px -3px -8px -24px; + border-start-end-radius: 6px; background: var(--markdown-code-background); mask-image: linear-gradient(to right, transparent, #000 24px), linear-gradient(#000 calc(100% - 8px), transparent);