Skip to content

Renderers: concentric nested radii, and a group's border stays whole around its corners - #82

Open
agorischek wants to merge 5 commits into
mainfrom
agorischek/concentric-radii
Open

agorischek wants to merge 5 commits into
mainfrom
agorischek/concentric-radii

Conversation

@agorischek

@agorischek agorischek commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

The user, about the runtime-policy Network card on the blog: "We need to be more careful about our border radii."

Each crop is a corner at 4× (2× device scale, enlarged), light and dark, before and after.

What was wrong, and the fix

A group's header band covered its border's curve. The band had square corners. Since #61, a group clips at its outer edge, so its children aren't clipped inside the border, and the band painted over the inside of the border's curve. The border thinned to about 0.1 px at 45°. The band now takes the group's inner radius (--pk-group-inner-radius: the radius less the border), so it's concentric with the border.

runtime-policy Network card, top-left
text-diff group, top-right
agentic-workflows group, top-left

A change run at a group's bottom corner lost its edge around the curve. Text diff's last changed line and its scrolling body had square corners. The group's curve cut the run's edge off, so no border showed around the corner. The body's bottom corners are now the card's own, so it clips to the card's curve. The last line, each side of a split pair, and the gutter take the inner radius.

text-diff group ending in an added line, bottom-right

A group with a fractional height lost half its bottom border. The browser snaps a border to whole pixels, but it doesn't snap a clip-path. Where the browser supports overflow-clip-margin, a group now clips with overflow: clip and the border's width as its margin. That's the same outer edge, snapped together with the border. WebKit lacks the margin and keeps the clip-path.

runtime-policy panel, bottom-left

Graph and DI change cards weren't concentric. CSS sets the cards' rx to the theme radius (8), which overrides the kit's 6-unit attributes. Two things followed:

  • The change edge is inset by half a stroke but kept the full radius, so the grey border poked past the green curve.
  • The status band was a path drawn with a fixed 6-unit radius, so its corners poked out past the 8-px card as a light fringe.

Now the change edge's radius is the card's less its inset, and the band is clipped to the card's own CSS-rounded shape (node-card-shape).

DI added card, bottom-right
graph modified card, top-left

The corner check

cornerReport(page, target) in @githubnext/projections-renderer-testing/playwright (documented in the testing README under "Corners in pixels") measures a box's corners from screenshots, not from box metrics. It walks rays across each curve and sorts every pixel by its fit to the outside, the border and the inside colour. It fails when:

  • the border's thickness around the curve differs from its sides by more than ¼ px plus half a device pixel;
  • a third colour shows in the border, meaning a fill that isn't concentric with it;
  • paint shows outside the curve.

It finds each side where it's actually painted, so whole-pixel snapping doesn't skew it, and it scrolls a tall box so both pairs of corners get measured. It takes an element or a stroked SVG rect, and skips dashed outlines.

harness/browser/corners.spec.ts uses it on four representative corners (the runtime-policy panel, the text-diff group, the agentic-workflows group and a DI change card), in light and dark, in Chromium and WebKit. A negative case restores the square header and confirms the report catches it.

Audit

I ran the check, at 4×, on every bordered rounded element (up to three per class) in every built-in scenario, light and dark.

  • Before: about 3,000 corner failures. Most were these four causes; the rest were false positives (striped fills and text near small chips), which the helper now handles.
  • After: two kinds left, both expected:

The graph canvas is also rasterized below the device scale, so its strokes measure soft, and the representative spec uses crisp content. The api renderer is untouched, because the Changes work owns it.

Checks

  • tools check --fast
  • unit tests for kit, dependency-injection, text-diff, graph and testing
  • corners.spec in Chromium and WebKit
  • the built-in renderer checks (including Renderers: one line where a change region meets a group's edge #61's one line per boundary) for runtime-policy, text-diff, agentic-workflows and dependency-injection, on all three round-robin projects

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The corner checks can falsely fail correctly rendered elements by replacing valid zero CSS radii with SVG attribute values and using unscaled radii and border widths for transformed HTML targets.

2 open issues
What changed in this PR

This PR refines rounded borders across the renderer kit and built-in renderers, building on the earlier one-line-per-boundary changes. It keeps nested fills and change outlines concentric with their containers.

Changes:

  • Adjust group clipping, header radii and text-diff bottom corners to preserve border thickness.
  • Align graph change outlines and status bands with each card’s rounded shape.
  • Add screenshot-based corner measurements, browser regression tests and documentation.
File Description
packages/​renderers/​text-diff/​src/​styles.css Round scrolling bodies and final rows to match their cards.
packages/​renderers/​testing/​README.md Document the corner measurement helper and its limits.
packages/​renderers/​testing/​playwright/​index.ts Export corner testing helpers.
packages/​renderers/​testing/​playwright/​corners/​analyze.ts Analyze border thickness and stray paint from corner screenshots.
packages/​renderers/​testing/​playwright/​corners.ts Capture corner geometry and screenshots, then report failures.
packages/​renderers/​kit/​styles/​layout.css Add inner radii and supported overflow clipping for groups.
packages/​renderers/​kit/​styles/​graph.css Make change outlines concentric and define card clipping radii.
packages/​renderers/​kit/​src/​react/​graph-canvas/​group-node.tsx Reduce the fallback outline radius by its inset.
packages/​renderers/​kit/​src/​react/​graph-canvas/​cards.tsx Remove the fixed-radius footer path helper.
packages/​renderers/​kit/​src/​react/​graph-canvas/​card-change.tsx Clip status bands to card shapes and adjust outline radii.
packages/​renderers/​harness/​browser/​corners.spec.ts Add representative light/dark checks and a negative regression case.
docs/​reference/​renderer-kit.md Update API descriptions for card radii and clipping.
docs/​guides/​renderer-kit-components.md Explain group clipping and concentric inner corners.

Review effort: Balanced

@agorischek

Copy link
Copy Markdown
Collaborator Author

The Operations CLI card the user saw on :4395 (storefront-platform admin-cli, text-diff, dark), top-left corner at 4×, from main and from this branch. I ran cornerReport on all three command cards: main has 22 to 29 corner failures in each of light/dark × diff/side-by-side, and this branch has none, in Chromium and WebKit.

admin-cli card corner, dark: main vs #82
admin-cli card corner, light: main vs #82

Tables (0d82f6e). cornerBox now reads a database card's inset outline, and frame covers a data table's scroll box, whose heading and rows draw its lines. I audited every DataTable frame and every database card frame in every database and code-statistics scenario: light and dark, diff and side-by-side, at rest, and with the first card, its bottom column row and a table's first and last rows selected or hovered. There were no failures on this branch in either engine. corners.spec now covers a data table and a database card in all of those states, and a negative case confirms that a square DataTable heading is caught.

agorischek and others added 4 commits November 20, 2026 19:17
…ole around its corners

A group's header band was square, so it covered the inside of the border's top curve, where the border thinned to
nothing (the runtime-policy Network card on the blog). It takes the group's inner radius now
(--pk-group-inner-radius, the radius less the border), as a renderer's last row or band does at the bottom: text
diff's last line and its scrolling body follow the card's curve, so a changed line's edge turns the corner with it.

The group clips with overflow: clip and the border's width as its margin where the browser has that margin: the
clip-path wasn't snapped to whole pixels as the border is, and cut off half the bottom border of a group with a
fractional height. WebKit keeps the clip-path.

Graph and DI cards: the change edge's CSS radius is the card's less its inset, concentric with the card's border, and
the status band is clipped to the card's own shape rather than drawn with a fixed 6-unit radius under an 8-px card,
which poked out past its corners.

cornerReport (renderer testing) measures a box's corners in pixels: the border's thickness around each curve against
its sides, a third colour in it, and paint outside the curve. The harness checks representative cards with it, in
both engines and both color modes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…s on the box

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nd hovered

cornerBox reads an element's solid outline where it has no border (a database card's inset edge), and takes the
width of a frame its contents draw (a data table's scroll box, whose heading and rows draw its lines). The harness
checks a data table's frame and a database card's corners at rest and with their first and bottom rows selected and
hovered, light and dark, and that a data table's square heading is caught.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@agorischek
agorischek force-pushed the agorischek/concentric-radii branch from 7051884 to 00cf737 Compare November 21, 2026 03:21

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants