Skip to content

fix(RadioList): the pressed circle reads the row's press through a custom property, not a :has() scan - #8424

Merged
cixzhang merged 1 commit into
mainfrom
fix/radio-list-press-no-descendant-has
Oct 25, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/radio-list-press-no-descendant-has

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

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

  • The row declares the mouse press's paint in an internal custom property, --_radio-row-press, under .row:active:not(:has(a:active, button:active, [role="button"]:active, [role="link"]:active)). Under a coarse pointer it declares transparent, as the old rule did.
  • The layer over the circle paints var(--_radio-row-press, transparent). This is the same inheritance the touch press already uses for --_press-paint.
  • One row-scoped :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 *.
  • The custom property is internal: no new prop, export or theme hook.

Testing

  • Real Chrome 156 on Storybook builds of main and this branch (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.
  • Per-Enter style cost from the shared 1,500-paragraph harness (Chromium 156, 15 presses), with the document inside a RadioList row's description: 0.25 ms (2 elements restyled) on main, 0.20 ms (2 elements) here; at 4× CPU throttle 0.95 → 0.85 ms. With the RadioList beside the document the cost is unchanged (0.06 ms, 1 element).
  • RadioList.test.tsx now asserts that the row declares the paint with the nested-control exclusion and that the layer reads it. RadioListItem.press.source-build.test.mjs compiles the module's CSS and fails on any :has() followed by a descendant *. Both fail on main, and the row assertion fails without the row style.
  • RadioList tests 96/96; typecheck, lint, prettier, changeset and sync checks pass.

…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 *.
@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 25, 2026 4:41pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 25, 2026
@astracat-bot

astracat-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 25, 2026, 5:13 PM UTC

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/RadioList 42.5KB 42.5KB 0B 7.8KB 7.8KB 0B
core/RadioListItem 49.2KB 49.2KB +21B 9.4KB 9.5KB +34B

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 Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 33.7KB 33.7KB +24B

Accessibility Audit

Status: 2 accessibility violation(s) found — 2 serious.

Radio group pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RadioList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

48 of 502 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 556,900
RichTextEditor Markdown parity: side by side probe light 538,816
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 28 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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."

@cixzhang
cixzhang merged commit f57df18 into main Oct 25, 2026
70 checks passed
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
…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.
@github-actions
github-actions Bot deleted the fix/radio-list-press-no-descendant-has branch October 26, 2026 06:31
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…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.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…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.

This branch was successfully deployed

1 active deployment
Preview — 43516f1c Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant