mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 08:39:02 +03:00
fix(app): keep code block borders under the action fill (#64576)
This commit is contained in:
committed by
GitHub
Unverified
parent
cf9d13072c
commit
852d5ed0b3
@@ -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)
|
||||
})
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user