fix(ui): keep file accordion borders visible when scaled (#47461)

Co-authored-by: Hona <10430890+Hona@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-09-05 08:47:54 +00:00
committed by GitHub
Unverified
parent 4306c07b34
commit 5045b3ce18
2 changed files with 70 additions and 2 deletions
@@ -0,0 +1,68 @@
import { expect, test } from "@playwright/test"
import { createTwoFilesPatch } from "diff"
import { assistantMessage, setupTimeline, toolPart, userMessage } from "../performance/timeline-stability/fixture"
test.use({
deviceScaleFactor: 2,
// Emulating DPR alone does not exercise Chromium's native hairline border rounding.
launchOptions: { args: ["--force-device-scale-factor=2"] },
})
for (const width of [1400, 390]) {
test(`patch file borders retain a full CSS pixel at ${width}px on high-density displays`, async ({ page }) => {
const file = `src/${"long-directory/".repeat(12)}patch-border.ts`
await setupTimeline(page, {
messages: [
userMessage(),
assistantMessage([
toolPart(
"prt_border_patch",
"patch",
"completed",
{ patchText: "Update file" },
{
metadata: {
files: [
{
file,
status: "modified",
additions: 1,
deletions: 1,
patch: createTwoFilesPatch(file, file, "const value = 1\n", "const value = 2\n"),
},
],
},
},
),
]),
],
reducedMotion: true,
viewport: { width, height: 900 },
})
await page.getByRole("button", { name: "Used 1 Patch", exact: true }).click()
const patch = page.locator('[data-component="apply-patch-tool"]')
const trigger = patch.getByRole("button", { name: /patch-border.ts/ })
await expect(trigger).toHaveAttribute("aria-expanded", "false")
await expect(trigger).toHaveCSS("height", "32px")
for (const side of ["top", "right", "bottom", "left"]) {
await expect(trigger).toHaveCSS(`border-${side}-width`, "1px")
}
const box = await trigger.boundingBox()
await trigger.hover()
expect(await trigger.boundingBox()).toEqual(box)
await page.mouse.move(0, 0)
expect(await trigger.boundingBox()).toEqual(box)
await trigger.click()
await expect(trigger).toHaveAttribute("aria-expanded", "true")
const content = patch.locator('[data-slot="accordion-content"]')
await expect(content).toBeVisible()
for (const side of ["left", "right", "bottom"]) {
await expect(content).toHaveCSS(`border-${side}-width`, "1px")
}
await expect(content).toHaveCSS("border-top-width", "0px")
await trigger.press("Enter")
await expect(trigger).toHaveAttribute("aria-expanded", "false")
})
}
@@ -36,7 +36,7 @@
user-select: none;
background-color: var(--v2-background-bg-base);
border: 0.5px solid var(--v2-border-border-base);
border: 1px solid var(--v2-border-border-base);
border-radius: 0;
box-shadow: none;
overflow: clip;
@@ -80,7 +80,7 @@
&[data-expanded] {
[data-slot="accordion-content"] {
border: 0.5px solid var(--v2-border-border-base);
border: 1px solid var(--v2-border-border-base);
border-top: 0;
background-color: var(--v2-background-bg-layer-01);
}