Repository navigation
fix(RadioList): the pressed circle reads the row's press through a custom property, not a :has() scan - #8424
Conversation
…stom property, not a :has() scan The layer over the radio circle read the row's mouse press through `.layer::after:where(.row:active:not(:has(a:active, ...)) *)`: a `:has()` on an ancestor followed by a descendant `*`, which makes the browser re-check everything under the row whenever anything in it changes. The row now declares the press's paint in an internal custom property (`--_radio-row-press`) under `.row:active:not(:has(a:active, ...))`, and the layer paints `var(--_radio-row-press, transparent)`. The `:has()` stays, on the row itself with no descendant selector after it, because it is what keeps a pressed link or button inside the row from making the radio look pressed; a change inside the row now re-checks the row alone. This is the inheritance the touch press already uses (`--_press-paint`). Every state is unchanged: pixel-identical at rest, with the row pressed, and with a nested link pressed, in light, dark, RTL and forced colors. Tests assert the row declares the paint with the nested-control exclusion and the layer reads it; a source-build test fails on any :has() followed by a descendant *.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewComponent Size
Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included. Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: 2 accessibility violation(s) found — 2 serious. Radio group pattern - 1 issue(s)
RadioList - 1 issue(s)
Visual Regression48 of 502 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 28 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Approval recommended: the pressed radio circle renders identically before and after this change in every pressed state checked, including a nested link, a disabled row, dark mode, forced colors, RTL and a coarse pointer. One optional fix: the changeset says a large page "no longer restyles everything under each row whenever anything inside it changes", but content changes inside a row restyle the same two elements before and after, and the saving shows up when a link inside the row is pressed, so consider narrowing the changeset (and the matching comments in RadioListItem.tsx and the new test's header) to that case.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] `RadioList`'s pressed circle no longer comes from a `:has()` check that reached every element under the row, so a large page no longer restyles everything under each row whenever anything inside it changes. The row is pressed and the circle shows it exactly as before, and a link or button inside the row still keeps its own press. |
There was a problem hiding this comment.
This reads broader than what changes. With 1,500 paragraphs in one row's description, appending a paragraph, link or button inside the row restyles 2 elements both before and after this change, and pressing the row itself still restyles everything under it; the saving is when a link inside the row is pressed (3,028 elements restyled before, 4 after). Suggested: "…so pressing a link or button inside a row no longer restyles everything under that row."
…change RadioListItem takes main's row-declared mouse press (meta#8424: the circle's layer reads `--_radio-row-press`) beside this change's per-owner touch press layer, which replaces the row's `pressedAlpha` strength arms.
…ess controller, and a nested link or button takes its own press A fine pointer's press (spec:AST-094 FR11, FR43, DEC-21) goes through the press controller on every device, in place of the browser's :active: a mouse's primary click paints at pointerdown through the button slot, holds while the button is down (through a drag off the surface, as :active does), and fades at the release on a finger's clock on that device; a pen presses at once, in a scroll view too, and the scroll brake stays a finger's. A right click, a ctrl-click on macOS and a pen's barrel button paint nothing, through one shared rule (utils/primaryClick.ts). A Space press keeps its path: :active where the primary pointer is fine, the controller on a phone or tablet, on the deselect clock (only a key now writes PRESS_INPUT_ATTRIBUTE). A native control inside a pressable surface (a[href], button, role=button, role=link) takes its own press for every pointer, the rule RadioListItem's :active:not(:has(...)) arm kept for a mouse (meta#8424): a press on a link in a row's description leaves the row at rest. No stylesheet change: the press arms already paint for every pointer and yield the colour arms while the controller paints; comments in interactionOverlay.stylex.ts, Button.tsx and the hook's docs say the new model. Two unit cases encoding the superseded desktop rule (a mouse left to :active; a mouse press on a coarse device keeping the 200 ms release) become the fine-pointer cases and a Space-only case.
…FR43) The press controller now treats a link or a button inside a pressable row as a press boundary for every pointer (meta#8682), the job the row's mouse `:active:not(:has(a:active, button:active, …))` arm did for a mouse alone (meta#8424). So a RadioList row drops that arm and its `--_radio-row-press` paint, and the layer over its circle reads the press the controller marks, for a finger, a mouse and a pen alike, releasing on the row's clock (spec:AST-094 FR11's fine-pointer profile, FR43). Tests: the row declares no `:active` paint and no press rule sits behind a pointer query (both fail on the previous head); the source-build test now pins that the row ships no `:active` press and keeps the no-ancestor-scan case; the mouse press cases take a radio row too.
User impact
Nobody sees a difference: the radio circle shows a press exactly when it did before, and a link or button inside a row still keeps its own press. What changes is the cost of the rule behind it. The layer over the circle read the row's mouse press through
.layer::after:where(.row:active:not(:has(a:active, …)) *), a:has()on an ancestor followed by a descendant*. That shape makes the browser re-check everything under the row whenever anything in it changes.Change
--_radio-row-press, under.row:active:not(:has(a:active, button:active, [role="button"]:active, [role="link"]:active)). Under a coarse pointer it declarestransparent, as the old rule did.var(--_radio-row-press, transparent). This is the same inheritance the touch press already uses for--_press-paint.:has()remains, and why: it is what keeps a pressed link or button inside the row from making the radio look pressed, and no other CSS can express "the row is pressed, but not through a nested control". It now sits on the row itself and no descendant selector follows it, so a change inside the row re-checks only the row, not everything under it. That fits the proposed guard against:has()followed by a descendant*.Testing
core-radiolist--default, with a link added inside a row, real mouse input held down): 12 of 12 states are pixel-identical (at rest, the row pressed, and the nested link pressed; light, dark, RTL and forced colors). The circle's layer computes the same colour in every state:rgba(0,0,0,0.1)(rgba(255,255,255,0.1)in dark) while the row is pressed, and transparent while the link is the pressed one.RadioList.test.tsxnow asserts that the row declares the paint with the nested-control exclusion and that the layer reads it.RadioListItem.press.source-build.test.mjscompiles the module's CSS and fails on any:has()followed by a descendant*. Both fail onmain, and the row assertion fails without the row style.