Skip to content

fix(SelectableCard): a selected card shows a Highlight ring under forced colors - #14029

Merged
cixzhang merged 8 commits into
mainfrom
l0/selectable-card-forced-colors
Nov 29, 2026
Merged

cixzhang merged 8 commits into
mainfrom
l0/selectable-card-forced-colors

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A person using Windows High Contrast (forced colors) cannot tell which SelectableCards are selected: a selected card paints exactly like an unselected one, so they cannot see their choices in a multi-select group (WCAG 1.4.11 non-text contrast). After this change, a selected card draws a 2px ring in the system Highlight color inside its edge, in every variant, when disabled, with zero padding, and under a theme that sets the card's border color. The ring takes no space, so selecting or clearing a card moves nothing on the page. Two stated limits: on a fixed-height card whose content scrolls, the ring scrolls with that content; and on a card with zero padding, whose content sits flush with its edge, the inset ring covers the outer 2px of that content.

Problem and solution fit

  • Why does it happen? Selection is shown by an inset box-shadow ring plus a border color. Forced colors remove box shadows and repaint borders in a system color, and palette variants draw no border at all.
  • Why does that harm the task? Nothing else marks selection on screen, so the selected state is invisible.
  • Why does that matter? A High Contrast user cannot review or correct a multi-select choice before submitting it.

The fix draws one forced-colors-only ring on the card's existing ::after layer, in a system color that forced colors keep.

Expected behavior and authority

component:SelectableCard FR3: selection shows a ring on the card. WCAG 1.4.11 requires the selected state to stay perceivable in forced colors, as SegmentedControlItem FR5 already does with Highlight. The record's FR3 now states the forced-colors ring and its one gap, with a matching Verification row.

Smallest restoration

  • SelectableCard.tsx: under @media (forced-colors: active), a selected card's ::after draws 2px solid Highlight. The layer already holds the hover and press overlay; a disabled card, which has no overlay, gets a layer of its own for this. The layer is absolutely positioned, so it takes no space, and a theme's border color on the card does not reach it, so the ring keeps Highlight where a theme sets the card's border color. The focus outline stays its own.
  • Outside forced colors nothing changes: every style sits behind the media query.
  • No new API, prop, token or data attribute.

Evidence

  • Reproduction before the change: in Chromium with forced colors emulated, the selected card's ring layer has a 0px border and its edge pixel matches the unselected card's; 6 of 8 browser cases fail (the toggle case and the outside-forced-colors case pass on the base by construction), and the jsdom case fails because no forced-colors ring is compiled.
  • Result after the change (8/8 browser cases, three runs): on the multi-select, color-variants and disabled stories a selected card's ::after is 2px solid in the resolved Highlight color and an unselected card's is 0px; the edge pixel equals a Highlight swatch; under the probe theme, which sets borderColor on selectable-card, the ring is still Highlight; a zero-padding selected card rings with its padding left at 0; turning the only selected card off leaves every card's box unchanged.
  • The toggle case is mutation-sensitive: against a version that draws the ring as a border on the card's own box without a padding give-back, it fails (the row's height changes from 46px to 44px).
  • Forced colors in real Chromium, main vs this head, dark and light high-contrast palettes (measured computed styles; stills in the review thread):
    • Neutral, butter, gothic and probe themes: a selected default card draws the 2px Highlight ring inside its unchanged 1px border; on main a selected card is identical to an unselected one. A muted card goes from no ring to a 2px Highlight ring when selected.
    • Focus plus selected: the Highlight ring and the 2px focus outline both show, each on its own property.
  • Representative unchanged path: every SelectableCard story (single-select, multi-select, color variants, nested button, disabled) in the neutral and probe themes, light and dark, is pixel-identical before and after outside forced colors (20 of 20 frames). As a positive control, the forced-colors multi-select frame differs from the base (782 px), so the comparison is not blind. The existing SelectableCardAudit.a11y.chromium.spec.ts passes (7/7).
  • Regression test or other mutation-sensitive proof: SelectableCardForcedColors.a11y.chromium.spec.ts (new) and the SelectableCard forced colors (FR3) jsdom case fail on the code before this change and pass with it.

Before and after stills of the stories in forced colors were captured; they are described above as text.

Scope

Components: SelectableCard

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Overlap checked: #14017, #13733, #13734, #12231, #12348, #9097 (#14017 added the disabled theming target and is merged here without conflict in behavior; #13733 and #13734 add SelectableCardGroup and wait on an owner decision; #12231 and #12348 are the nested-control press paint; #9097 is Text; none of them draws a forced-colors selection indicator)

Writing rubric results

Scanned the added and re-padded lines (at the current head) of docs/specs/components/SelectableCard/SelectableCard.spec.md against R1–R7 in docs/contributing/spec-writing.md:

  • R1 (a change described instead of the system): none. The new FR3 sentences describe what a selected card draws under forced colors and the one case where the ring scrolls.
  • R2 (research in the record): none.
  • R3 (an evidence, basis or verification cell naming a PR, issue or commit): none; the new Verification row names test files, stories and a stated gap.
  • R4 (a rejected alternative longer than one line or outside its decision): none.
  • R5 (#digits, /pull/ or /issues/ as standing content): none.
  • R6 (an answered open question still listing options): none.
  • R7 (project status): none.

Testing

  • pnpm exec vitest run --project ui packages/core/src/SelectableCard/ (26/26) and all of packages/core/src in the ui project (994 files, 25,334 tests).
  • pnpm exec playwright test packages/core/src/SelectableCard/__tests__/SelectableCardForcedColors.a11y.chromium.spec.ts --project chromium (8/8, three runs; red first on the code before this change), and SelectableCardAudit.a11y.chromium.spec.ts (7/7).
  • Real-browser states: Chromium with forcedColors: 'active' and 'none', desktop viewport; Playwright's WebKit matches the forced-colors query but forces nothing, so the spec is Chromium-only.
  • pnpm check:knowledge, pnpm check:changesets, pnpm check:repo, ESLint, Prettier and tsc for core are clean.

Open decision

Resolved. With the ring on the ::after layer, a theme that sets the card's border color does not reach the forced-colors ring, so no precedence decision is needed here.

…colors

Forced colors drop the selection ring's inset shadow and repaint the
border, and palette variants draw no border, so a selected card painted
the same as an unselected one in Windows High Contrast. Under
@media (forced-colors: active) the selected card's ::after layer now draws
a 2px ring in the system Highlight color inside its edge (a disabled card
gets its own layer). Layout does not move and the focus outline stays its
own; normal color modes are unchanged.
@vercel

vercel Bot commented Nov 29, 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 Nov 29, 2026 6:03pm UTC

Request Review

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

astracat-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 29, 2026, 7:09 PM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 29, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 29, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 464aba7

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 3b8c819

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
SelectableCard · Storybook 19.8 kB (+109 B) · 8.2 kB CSS (+125 B) 450 (+24) ✓ · ✓ · —
lab/SelectableCardGroup 74.1 kB (+106 B) · 162 B CSS (0) — — · — · —

Package size: @astryxdesign/core 8.10 MB packed (+516 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.

Accessibility: 2 violation(s)

Accessibility Audit

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

Checkbox 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 1/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
SelectableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | 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.

Requesting changes: the forced-colors ring makes a selected SelectableCard visible in Windows High Contrast, but one supported layout breaks the behaviour the changeset describes.

  • A SelectableCard with a fixed height scrolls its content (Card applies overflow: auto), and the ring is a border on an absolutely positioned ::after that scrolls with that content, so on a scrolled card the ring crosses the text and leaves the lower edge unmarked, which makes "a selected card now draws a 2px ring in the system Highlight color inside its edge" untrue for that card.

Drawing the forced-colors ring on the card's own box (for example a Highlight border on the root under forced colors, with Card's padding compensation so layout does not move) and adding a scrolled fixed-height case to the new Chromium spec would resolve it; if that case is accepted instead, state it in FR3, the changeset and the description. Separately, and not blocking, the comment above selectedForcedColors packs three topics into one 28-word sentence, so splitting it would match the repository's source-comment style.

Claims and files checked

Review mode: same-head; reason: none

  • Live title: "fix(SelectableCard): a selected card rings in Highlight under forced colors".
  • changed rules (0): none
  • Claim (title): a selected card rings in Highlight under forced colors: verified (SelectableCard.tsx:198-207, :594).
  • Claim (changeset and description): in forced colors a selected card draws a 2px Highlight ring inside its edge, in every variant and when disabled, so the selection stays visible: false for a selected fixed-height card whose content scrolls (the ring scrolls with the content); holds for every built-in variant and the disabled card when the card does not scroll (the style does not depend on the variant, and the new Chromium spec asserts it on three stories).
  • Claim (changeset): before, a selected card painted the same as an unselected one: reported (base behaviour; consistent with the code, since forced colors drop the inset shadow and repaint the border, and only the default variant draws a border).
  • Claim (changeset): normal colour modes are unchanged: verified (every added declaration is unset outside the forced-colors query; the changed files and the component's direct importers add nothing else).
  • Claim: selection is an inset shadow ring plus a border colour, forced colors remove shadows and repaint borders, and palette variants draw no border: verified (SelectableCard.tsx:242-285, Card.tsx:91-92, :359).
  • Claim: nothing else marks selection on screen: verified (the checkbox is visually hidden, SelectableCard.tsx:226-236, :644).
  • Claim: SegmentedControlItem already shows its selected state with Highlight under forced colors: verified (its record's FR5).
  • Claim: the ring uses the existing ::after layer and a disabled card gets a layer of its own: verified (SelectableCard.tsx:139-144, :198-221, :594-595).
  • Claim: layout does not move and the focus outline stays its own: verified (the layer is absolutely positioned; the focus indicator is the root's outline).
  • Claim: every added style sits behind the media query: verified (SelectableCard.tsx:200-219).
  • Claim: no new API, prop, token or data attribute: verified (the only non-test source change is private styles in SelectableCard.tsx).
  • Claim: the record's FR3 states the ring and has a matching verification row: verified (SelectableCard.spec.md:151, :168, :249).
  • Claim: none of the six overlapping pull requests draws a forced-colors selection indicator: verified (every file each of them changes; no added forced-colors or Highlight line).
  • Claim: the writing rubric finds nothing in the added record lines: verified (the FR3 sentence, the Selected state and the verification row).
  • Reported: the before and after browser runs, the 20 unchanged frames, the existing audit spec 7/7, the red-first runs of both new tests, the unit and Playwright counts, the clean repository checks, and WebKit forcing nothing.
  • File .changeset/selectable-card-forced-colors-selected.md: finding (the ring-inside-its-edge claim is false for scrolling fixed-height cards).
  • File docs/specs/components/SelectableCard/SelectableCard.spec.md: clear (the FR3 change is owner-approved for this head; the code misses its "inside its edge" for scrolling cards).
  • File packages/core/src/SelectableCard/SelectableCard.tsx: finding (the ring scrolls with a fixed-height card's content); non-blocking comment-style note.
  • File packages/core/src/SelectableCard/SelectableCard.test.tsx: clear.
  • File packages/core/src/SelectableCard/__tests__/SelectableCardForcedColors.a11y.chromium.spec.ts: clear apart from the missing scrolled fixed-height case.

Automated review (maintainer link)

The ring was a border on the absolutely positioned ::after layer, which
scrolls with the content of a fixed-height card (Card makes it
overflow: auto), so on a scrolled card the ring crossed the text and left
the lower edge unmarked. Under forced colors a selected card now draws a
2px Highlight border on its own box, and its padding gives up the same
2px, so the content does not move. The styles are a separate class, so
their unset defaults do not reset the card's border or padding in normal
color modes. The disabled card no longer needs a layer of its own.

Adds a scrolled fixed-height case to the browser spec.
…rder on the card's edge

The forced-colors ring is now the card's own border, so the record and the
changeset say so, including the scrolled fixed-height case and its new
verification.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7055305

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026

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

Requesting changes: the forced-colors border keeps a selected SelectableCard visible in Windows High Contrast and stays on the edge of a scrolled fixed-height card, but two claims in the changeset and description are broader than what the code does.

  • With padding={0} (as in the product-detail template's image thumbnails and the docsite theme picker), the 2px padding give-back in SelectableCard.tsx:202-221 clamps at zero, so a selected card's content moves 2px inward and the card grows 4px (or its image shrinks 4px at a fixed size), which contradicts "The content does not move" in the changeset and "layout does not move" in FR3.
  • A theme that sets a border colour on the selectable-card or card target, as the repository's probe theme does, wins over the new rule from its higher cascade layer, so forced colors repaint the selected border in the text colour instead of Highlight, which contradicts "a 2px border in the system Highlight color" for every variant.

Either narrow FR3, the changeset and the description to the cases that hold, or handle both cases in code, and add a padding={0} case and a themed case to the new Chromium spec. Separately, and not blocking, the comment at SelectableCard.tsx:585-587 joins two topics in one 27-word sentence.

Claims and files checked

Review mode: same-head; reason: none

Live title: fix(SelectableCard): a selected card rings in Highlight under forced colors

Claims:

  • Title, a selected card rings in Highlight under forced colors: verified in code (SelectableCard.tsx:198-201, :588-591), except under a theme that sets the card's border colour (false, second finding).
  • Today a selected card paints like an unselected one under forced colors: reported (base behaviour), consistent with the base code.
  • A 2px Highlight border on the card's own edge in every variant and when disabled: false under a theme that sets the card's border colour; otherwise verified (no variant or disabled branch).
  • The border stays on the edge when a fixed-height card scrolls: verified (root border; Card.tsx:118-121; spec case at :144-192).
  • Each padding side gives up 2px, so the content does not move: false for padding under 2px (first finding); verified at the theme padding.
  • The focus outline stays separate: verified (focusWithinOwner unchanged).
  • Nothing changes outside forced colors, and the null defaults never reset the card's border or padding: verified (separate class, SelectableCard.tsx:584-591).
  • No new API, prop, token or data attribute: verified from source.
  • FR3 now states the forced-colors ring with a matching verification row: verified (SelectableCard.spec.md:151, :168, :249).
  • Writing rubric results for the record edits: verified on the added lines.
  • Browser runs before and after, 20 identical frames, red-first runs, unit, lint and type runs: reported; not run in CI at this head.
  • Overlap with other open pull requests: reported.
  • Changeset, Highlight border on the card's own edge, also when scrolled: false under a themed card border, otherwise verified; the content does not move: false (first finding); normal colour modes unchanged: verified.

Files:

  • .changeset/selectable-card-forced-colors-selected.md: both findings (its claims).
  • docs/specs/components/SelectableCard/SelectableCard.spec.md: first finding (FR3's "layout does not move"); the other edits match the code and tests.
  • packages/core/src/SelectableCard/SelectableCard.tsx: both findings; comment-style note.
  • packages/core/src/SelectableCard/SelectableCard.test.tsx: clear.
  • packages/core/src/SelectableCard/__tests__/SelectableCardForcedColors.a11y.chromium.spec.ts: covers neither a padding-0 card nor a themed card (both findings).

Automated review (maintainer link)

…f the forced-colors ring

A card with zero padding has no padding to give up, so its content area
loses the 2px border on each side. A theme that sets the border color on
the selectable-card or card target owns that color under forced colors
too, as it owns the border elsewhere. FR3, the changeset and the browser
spec now cover both; the spec adds a zero-padding case.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec ab0a2dc

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

Requesting changes: the forced-colors border keeps a selected SelectableCard visible in Windows High Contrast, and the scrolled fixed-height and themed-border cases now hold, but three claims are still broader than what the code does.

  • A padding={0} card sized by its content grows 4px when selected, because every element is border-box and the 2px border adds to the box, so "its content area loses the 2px on each side" in FR3, the changeset, the description and the source comment holds only for a fixed-size card (the docsite theme picker's selected card grows 4px taller).
  • Miss: padding a caller sets through xstyle is replaced by the theme padding minus 2px when a selected card is in forced colors, and padding from style or a plain CSS class gets the 2px border added, so "the padding gives up the same 2px, so the content does not move" holds only for padding from the padding prop or the theme.
  • The title says a selected card rings in Highlight, which a theme that sets the card's border colour overrides, as FR3 and the changeset now say; a title such as "a selected card shows a border under forced colors" fits.

Separately, the branch now conflicts with main in the SelectableCard record since #14017 merged, and the resolved FR3 needs a fresh /approve-spec.

Claims and files checked

Review mode: full; reason: spec-record

Live title: fix(SelectableCard): a selected card rings in Highlight under forced colors

Claims:

  • Title, a selected card rings in Highlight under forced colors: false under a theme that sets the card's border colour (third finding); verified for the shipped themes.
  • Today a selected card paints like an unselected one under forced colors: reported, consistent with the base code.
  • A 2px Highlight border on the card's own edge in every variant, when disabled and on a scrolled fixed-height card: verified (no variant or disabled branch; the border sits on the root; Chromium spec cases).
  • A zero-padding card's content area loses 2px on each side: false for a card sized by its content (first finding); verified for a fixed-size card.
  • A theme that sets the card's border colour keeps it under forced colors: verified (the theme layer sits above the component layer).
  • Each padding side gives up 2px, so the content does not move: false for padding set through xstyle, className or style (second finding); verified for the padding prop and theme padding.
  • The focus outline stays separate: verified (outline, not border).
  • Nothing changes outside forced colors, and the unset defaults never reset the border or padding: verified (own class, declarations only under the media query).
  • No new API, prop, token or data attribute: verified from source.
  • No shipped theme sets the card's border colour: verified (all seven published theme sources enumerated; only the private probe theme does).
  • FR3 states the forced-colors border, with a matching representative state and verification row: verified.
  • Writing rubric results for the record edits: verified on the added lines.
  • Browser measurements, the 20 unchanged frames, red-first runs, unit, lint and type runs: reported; CI has not run them on this head.
  • Overlap with other pull requests: reported; stale for #14017, which has merged.
  • Changeset: Highlight border on the card's own edge, also when scrolled: verified; the content does not move: false for caller-set padding (second finding); a zero-padding card's content area loses 2px: false for content-sized cards (first finding); a theme keeps its border colour: verified; normal colour modes unchanged: verified.

Files:

  • .changeset/selectable-card-forced-colors-selected.md: first and second findings.
  • docs/specs/components/SelectableCard/SelectableCard.spec.md: first and second findings (FR3); the other edits match the code; conflicts with main.
  • packages/core/src/SelectableCard/SelectableCard.tsx: second finding; its comment shares the first.
  • packages/core/src/SelectableCard/SelectableCard.test.tsx: clear.
  • packages/core/src/SelectableCard/__tests__/SelectableCardForcedColors.a11y.chromium.spec.ts: the zero-padding case checks no size (first finding); otherwise clear.

Automated review (maintainer link)

Resolve the SelectableCard record against #14017: keep main's FR1, FR5 and
verification table, and re-add the forced-colors sentence on FR3 and the
"FR3 (forced colors)" row.
… again

The border on the card's own box either moved the content (where padding
could not absorb it), overrode a caller's padding, or, without the padding
give-back, shifted the layout on every toggle; and a theme's border color
won over Highlight. The ::after layer takes no space, so a toggle moves
nothing, and a theme does not style it, so the ring keeps Highlight under a
theme that sets the card's border color. The one gap: on a fixed-height card
whose content scrolls, the layer scrolls with that content. FR3, the
changeset and the verification row say so.

The browser spec adds a themed case and a case that a toggle moves no card.
With another card still selected, the row keeps its tallest card's height,
so a ring that took space would not move anything. Turning the only
selected card off makes such a ring change the row's height.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026
@cixzhang cixzhang changed the title fix(SelectableCard): a selected card rings in Highlight under forced colors fix(SelectableCard): a selected card shows a Highlight ring under forced colors Nov 29, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9a20347

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026

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

Requesting changes: the forced-colors ring on the card's ::after layer makes a selected SelectableCard visible in Windows High Contrast without moving anything, but three record and claim fixes are needed first.

  • FR3's new forced-colors sentence sits in the Basis column of the FR3 row (docs/specs/components/SelectableCard/SelectableCard.spec.md:148), so FR3's requirement still says nothing about forced colors; move it to the end of the Invariant cell and restore the Basis to Current source and tests.
  • "A theme does not style the layer" (FR3, the description and SelectableCard.tsx:196-197) is not true, because the theme compiler writes a style key's ::after block as authored, so a theme that writes border styles in a ::after block on selectable-card or card overrides the ring from the theme layer; say instead that a theme that sets the card's border color does not reach the layer.
  • The changeset says the ring sits inside the card's edge with no exception (.changeset/selectable-card-forced-colors-selected.md:5), but on a fixed-height card whose content scrolls the ring scrolls with the content, as FR3 and the description already say; add that clause to the release note.

The scrolled fixed-height behavior is a stated FR3 gap that an engineering owner approved for this head, so only the release note's wording remains for it. As a non-blocking suggestion, the new source comment at SelectableCard.tsx:194-198 can keep only its reasons and drop the restated declarations.

Claims and files checked

Review mode: same-head; reason: none

  • Live title: "fix(SelectableCard): a selected card shows a Highlight ring under forced colors".
  • Changed rules since the last review (0): none.

Claims:

  • Title: a selected card shows a Highlight ring under forced colors: verified (SelectableCard.tsx:199-208, :596).
  • The ring is 2px, inside the edge, in every variant, with the two stated limits: verified (no variant branch at SelectableCard.tsx:596; the absolute layer at :139-144).
  • The ring also shows on a disabled card: verified (SelectableCard.tsx:211-222, :597).
  • The ring shows on a zero-padding card with its padding left at 0, covering the outer 2px of flush content: verified (the layer is absolutely positioned and paints over in-flow content, SelectableCard.tsx:139-144).
  • The ring keeps Highlight under a theme that sets the card's border color: verified (the card's border and the layer's border are different boxes).
  • The ring takes no space, so a toggle moves nothing: verified (SelectableCard.tsx:139-144, :213-215, root position: relative at :83).
  • On a scrolled fixed-height card the ring scrolls with the content (stated limit): verified (Card.tsx:118-121, :334).
  • A theme does not style the layer: false (second finding).
  • The focus outline stays separate: verified (the focus ring is an outline on the root; the ring is a border on the layer).
  • Outside forced colors nothing changes: verified (every added declaration has a null default, SelectableCard.tsx:199-222).
  • No new API, prop, token or data attribute: verified (diff and source comparison).
  • FR3 now states the forced-colors ring and its gap, with a matching verification row: false (the sentence sits in the Basis cell; the verification row exists).
  • The overlapping disabled-target change merges without conflict: verified (the record's FR1, FR5 and verification rows match the base apart from the forced-colors additions).
  • Writing rubric: no pull request or issue references in the added record lines: verified.
  • Changeset: before, a selected card painted like an unselected one; now a 2px Highlight ring that takes no space, keeps Highlight under a themed border color, and leaves normal color modes unchanged: verified (as above; the base has no forced-colors rule for a selected card).
  • Changeset: the ring sits inside the card's edge: false for a scrolled fixed-height card (third finding).
  • Red-first runs, repeated browser runs, the mutation check, unchanged frames, the existing audit spec, unit test counts and repository checks: reported (CI has not run at this head).
  • WebKit forces nothing under emulated forced colors, so the spec is Chromium-only: reported.

Files:

  • .changeset/selectable-card-forced-colors-selected.md: third finding.
  • docs/specs/components/SelectableCard/SelectableCard.spec.md: first and second findings.
  • packages/core/src/SelectableCard/SelectableCard.tsx: second finding (comment); non-blocking comment wording.
  • packages/core/src/SelectableCard/SelectableCard.test.tsx: clear.
  • packages/core/src/SelectableCard/__tests__/SelectableCardForcedColors.a11y.chromium.spec.ts: clear.

Automated review (maintainer link)

…ant, with the narrower theme claim

Move the forced-colors sentence from FR3's Basis cell to the end of its
Invariant and restore the Basis. A theme can author a ::after block, so the
record, comment and changeset now say only that a theme's border color on
the card does not reach the layer. The changeset names the scrolled
fixed-height case.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 3b8c819

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 29, 2026

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

Approved pending CI. The forced-colors ring on the card's ::after makes a selected SelectableCard visible in Windows High Contrast without moving anything, and FR3's forced-colors sentence, approved for this head, covers the change.

CI on this head has passed its unit, typecheck, lint, visual and browser-spec jobs, including all eight new forced-colors cases; the remaining node test shards still have to finish before the merge guard lets it merge.

Two non-blocking observations, both already tracked in #14039:

  • On a fixed-height card, which Card makes a scroll container, the ring scrolls with the content and can leave the visible box entirely; FR3's sentence could say so, with the verification row's gap line kept until a case guards it.
  • A selected disabled card paints its Highlight ring at half opacity through the disabled dimming; WCAG 1.4.11 exempts inactive controls, so nothing is required.
Claims and files checked

Review mode: same-head; reason: none

Live title: fix(SelectableCard): a selected card shows a Highlight ring under forced colors

Changed rules (0): none

Claims:

  • A selected card shows a Highlight ring under forced colors: verified (SelectableCard.tsx:198-207, applied at :595; measured in Chromium with forced colors emulated).
  • The ring is 2px, inside the edge, in every variant: verified; there is no variant branch at :595, and none of the thirteen selected* styles (:242-293) declares a pseudo-element.
  • The ring also shows on a disabled card, which gets a layer of its own: verified (:210-221, applied at :596; the disabled selected card measures 2px solid Highlight, the disabled unselected card 0px).
  • A zero-padding card still rings, with its padding left at 0: verified; the layer is absolutely positioned, and a content-sized zero-padding card keeps the same box selected and unselected.
  • The ring keeps Highlight under a theme that sets the card's border color: verified; the theme compiler writes a target's declarations on the element selector and reaches ::after only for an authored pseudo-element block.
  • The ring takes no space, so a toggle moves nothing: verified; every card's box at the head equals its box on the base, in forced colors and outside.
  • On a scrolled fixed-height card the ring scrolls with the content (stated limit): verified and reproduced; the scrolled card can show no ring at all.
  • On a zero-padding card the ring covers the outer 2px of flush content (stated limit): verified by construction, since the layer paints over in-flow content.
  • Outside forced colors nothing changes: verified; every added declaration has a null default, and CI's stable visual shots of the single-select story are unchanged.
  • The focus outline stays its own: verified; the focus indicator is an outline on the root, the ring a border on the layer.
  • No new API, prop, token or data attribute: verified from the source and CI's API delta for this head, which lists no row.
  • Before the fix, selection is a box-shadow ring plus a border color, and palette variants draw no border: verified (:242-293; Card applies its border only to default).
  • FR3 now states the forced-colors ring and its one gap, with a matching verification row: verified (SelectableCard.spec.md:148, :165, :246).
  • WCAG 1.4.11 is met the way SegmentedControlItem already does with Highlight: verified; that component's FR5 states Highlight under forced colors.
  • Writing rubric R1-R7 over the added record lines: verified; the new lines describe the system, cite no pull request or issue, and carry no project status.
  • Release note (before, a selected card painted like an unselected one; now a 2px Highlight ring that takes no space, keeps Highlight under a themed border color, scrolls with a fixed-height card's content, and leaves normal color modes unchanged): verified, each clause as above.
  • Overlap with other pull requests: reported.
  • The new forced-colors browser spec fails before the change and passes 8 of 8 with it, and the jsdom case fails before and passes after: the passing half verified by CI at this head (pr-a11y browser specs, 164 passed, including all eight forced-colors cases; test-ui, SelectableCard.test.tsx 20 tests); the red-first half reported.
  • pnpm check:knowledge, check:changesets, check:repo, ESLint and tsc for core are clean, and the ui test project passes: verified by CI at this head (lint, typecheck, test-ui 4 of 4); Prettier reported.
  • The three repeated runs, the mutation check, the 20 unchanged frames, the existing audit spec (7/7), the full ui test counts and the real-Chromium high-contrast palette results: reported; nothing in the code or CI contradicts them.
  • WebKit matches the forced-colors query but forces nothing, so the spec is Chromium-only: reported.

Files:

  • .changeset/selectable-card-forced-colors-selected.md: clear.
  • docs/specs/components/SelectableCard/SelectableCard.spec.md: clear; the non-blocking scroll-wording note.
  • packages/core/src/SelectableCard/SelectableCard.tsx: clear; consistent with the record and the release note.
  • packages/core/src/SelectableCard/SelectableCard.test.tsx: clear; it asserts the compiled forced-colors rules, which is what jsdom can see.
  • packages/core/src/SelectableCard/__tests__/SelectableCardForcedColors.a11y.chromium.spec.ts: clear; it covers the three stories, the probe theme, the pixel at the edge, a toggle and a zero-padding card.

Automated review (maintainer link)

| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------ |
| FR1 | SelectableCard renders `component:Card` with the given `variant`, `elevation`, `padding`, and sizing. The root also carries the `selectable-card` target reflecting `variant`, `selected`, and, while disabled, `disabled`, and the first child is a visually hidden native `input type="checkbox"` named by `label` with `checked` equal to `isSelected`. | Current source and tests |
| FR2 | While enabled, a click on the card surface, a click or Space on the checkbox, or Enter on the checkbox calls `onChange(!isSelected)` exactly once. A click that belongs to nested interactive content, an open Tooltip or HoverCard surface (`component:Tooltip` FR11), or selected text does not toggle. A caller `onClick` runs after the toggle for a surface click, before it for a click or Space on the checkbox, and not at all for Enter; it also runs for clicks that do not toggle, including a click inside an open Tooltip or HoverCard surface. At the next minor, staged as `[breaking]`, a click inside an open layer stops at the layer root and the caller `onClick` no longer receives it (`architecture:layer-runtime` INV17); implementation gap: the current source still delivers that click to `onClick`. A caller `onMouseUp` runs after the card's own handling. | Current source and tests |
| FR3 | Selection adds a 2px inset ring through Card's ring variable, so layout does not move, and composes with any elevation shadow. `default`, `transparent`, and `muted` ring in `--color-accent`; each palette variant rings in its `--color-border-<name>`; a theme-added variant rings in `--selectable-card-ring-color`. Selection also colors the border in the ring color where Card draws one, which is only the `default` variant. Under forced colors, which drop the ring's shadow and repaint the border, a selected card, enabled or disabled, draws a 2px ring in the system `Highlight` color inside its edge instead, on a layer that takes no space and that a theme's border color on the card does not reach, so the selection stays visible, a toggle moves nothing, and the ring keeps `Highlight` under a theme that sets the card's border color; an unselected card draws none. On a fixed-height card whose content scrolls, the ring scrolls with that content. | Current source and tests |

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.

Non-blocking: "the ring scrolls with that content" reads as a partial loss, but the indicator can leave the visible box entirely. On a fixed-height card, Card's scroll container holds the absolutely positioned layer, so a card scrolled past the ring shows no selection at all while its computed ::after still reports 2px solid Highlight. Saying that the ring can scroll out of view would match what a High Contrast user meets, and the verification row's gap line covers the missing case until one guards it.

@cixzhang
cixzhang marked this pull request as ready for review November 29, 2026 18:45
@cixzhang
cixzhang merged commit 1703062 into main Nov 29, 2026
156 checks passed
@github-actions
github-actions Bot deleted the l0/selectable-card-forced-colors branch November 30, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 3b8c8191 Deployed Nov 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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