Skip to content

Pressed state for Switch, SegmentedControl, TabList, Link, Slider, CheckboxInput, RadioList, Collapsible - #6380

Merged
cixzhang merged 2 commits into
meta:mainfrom
vjeux:press-state-eight-components
Sep 20, 2026
Merged

cixzhang merged 2 commits into
meta:mainfrom
vjeux:press-state-eight-components

Conversation

@vjeux

@vjeux vjeux commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Pointer users now get immediate pressed feedback on eight previously silent controls. Disabled controls stay visually inert and cannot activate, and an already-selected SegmentedControl item keeps its raised surface unchanged.

Design authority

docs/design/user-states.md owns the bounded decision for:

  • CheckboxInput indicator
  • Collapsible trigger row
  • Link text surface
  • Slider dragged thumb
  • Switch track and thumb
  • Tab surface
  • RadioList indicator
  • unselected SegmentedControl item

Each enabled surface paints --color-overlay-pressed during pointer hold or drag. The record does not approve pressed behavior for other components or broader changes to hover, focus, or selection.

Implementation

  • Adds the pressed overlay to the approved surfaces while preserving their existing rest, hover, checked, selected, and forced-colors behavior.
  • Gates each pressed treatment out of disabled states.
  • Keeps selected SegmentedControl items unchanged.
  • Preserves Switch’s existing root attribute routing and component-owned label semantics.

Evidence

  • Focused unit tests verify pressed wiring, Slider drag ownership, the selected-segment exception, and disabled non-activation where DOM tests can prove it.
  • A real-Chromium Playwright test captures matched rest, held-pointer, released, disabled, and selected-exception pixels for all eight components.
  • CI publishes the PNGs, pixel diffs, Chromium version, viewport, story IDs, hashes, and exact PR-head SHA in the pressed-state-evidence-<sha> artifact.

Validation

  • pnpm check:knowledge
  • focused component tests
  • core lint and typecheck
  • Storybook build
  • pnpm test:a11y-contract
  • exact-head required CI and review gates

…eckboxInput, RadioList, Collapsible

Eight interactive components painted nothing while pressed, so on a phone (no
hover) a tap looked like nothing happened until the screen changed. Each now
paints the system's `--color-overlay-pressed` layer while pressed, the way
Button and every other composer of `interactionOverlayStyles` already does:

- Switch: track and thumb, read off the row's scope marker like the hover tint
- SegmentedControl: the unselected segment takes the shared hover + pressed
  overlay in place of its hover-only rule
- TabList: the tab's hover surface layer steps up to the pressed overlay
- Link: `interactionOverlayStyles.pressedBackgroundColor` (new: the press
  alone) behind the text, anchor and button forms; the hover stays the colour
- Slider: the thumb being dragged, for the whole drag, on mouse and touch
- CheckboxInput / RadioList: the indicator box / circle, read off the owner's
  `indicatorScope` like the hover tint
- Collapsible: the trigger row

Disabled controls never press. Each component's test asserts the pressed rule
on the element that paints it; the Slider test drives a pointer sequence.

Supporting: Switch forwards a caller's `id`, `aria-labelledby` and
`aria-describedby` to its `<input role="switch">` (they used to land on the
field wrapper, where nothing reads them), merging `aria-describedby` ahead of
its own ids the way CheckboxInput does.

Docs gain a `Pointer down` contrast state; each component gets a
`Pressed state` story.
@vercel

vercel Bot commented Sep 19, 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 Sep 20, 2026 2:33am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 19, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 19, 2026
github-actions Bot added a commit that referenced this pull request Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

CheckboxInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 335 -
Complexity N/A Very High (40) -
Slider (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 877 -
Complexity N/A Very High (126) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: 36 accessibility violation(s) found — 2 critical, 34 serious.

Button 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/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposer - 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/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposerInput - 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/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatReasoning - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatToolCalls - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 10/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
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 2/33 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CheckboxList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/17 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ClickableCard - 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)
CodeEditor - 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/7 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorPerf - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/2 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 13/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 14/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/21 stories · Learn more
    • WCAG: 4.1.2 (Level A)
FileInput - 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/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
GridMasonry - 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)
Heading - 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/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Icon - 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/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
LogStream - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
MediaTheme Auto - 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)
PowerSearch - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ProgressBar - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
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/26 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)
RichTextEditor - 2 issue(s)
  • 🟠 serious: Ensure every ARIA input field has an accessible name
    • Rule: aria-input-field-name · Affects 2/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
  • 🔴 critical: Ensure every form element has a label
    • Rule: label · Affects 1/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
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/4 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Stepper - 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/30 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
TableGroupedRows - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 3/3 stories · Learn more
    • WCAG: 4.1.2 (Level A)
TableTree - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 8/9 stories · Learn more
    • WCAG: 4.1.2 (Level A)
Text - 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/23 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Theme - 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)
PopArt - 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/6 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Thumbnail - 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/12 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Timestamp - 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/20 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Tokenizer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

Status: Skipped — Broad stable scope is deferred to the daily release gate. It covers 386 trusted baseline shots instead of recapturing them for this PR. View the report


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

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec f6d3595

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Sep 20, 2026
@cixzhang
cixzhang merged commit 6203871 into meta:main Sep 20, 2026
33 checks passed
@vjeux
vjeux deleted the press-state-eight-components branch September 29, 2026 03:15
cixzhang pushed a commit that referenced this pull request Oct 31, 2026
<!-- template: bug-fix.md -->

Sibling: #7516 (off-grid max). One change on `main`, with no dependencies.

## User impact

Found during the UIKit-parity work on Slider (`spec:AST-094`). A range Slider whose two thumbs share a value gets stuck. With both at the maximum, dragging down moves nothing; with both in the middle, a track press above them moves nothing. It happens with a mouse, a finger and a pen.

## Problem and solution fit

1. **Why it happens:** with equal values, a direct press keeps the upper thumb (#6380) and a track press takes the lower one, whichever way the pointer goes, and that thumb is clamped against its sibling.
2. **Why it matters:** coincident thumbs are a normal state, and in those directions no pointer path moves them; on `main` only a track press below them or a drag toward the maximum works.

Only one thumb can move toward a given value, so that thumb takes the press. A track press beside them picks the thumb on its side. A press on the thumbs waits for the pointer's first movement, whose direction picks the thumb, with its focus, pressed look and tooltip. A drag that passes the other thumb's value hands itself over.

## Expected behavior and authority

- `component:Slider` FR1 / AR1: two thumbs bound the range and never cross. `architecture:interaction-modality` INV4: every modality has an operable path. `design:user-states` DR4: the pressed overlay follows the dragged thumb.
- `component:Slider` FR6, added here: which thumb a press takes when both share a value, and the consequence that a drag coming back past the shared value moves the other thumb. It waits on the spec owner's approval. The alternative, keeping one fixed thumb, is what leaves a direction stuck.

## Smallest restoration

`Slider.tsx` only: the press and move handlers, and the value tooltip's `isOpen` during a drag. No new prop, style or visual. `Slider.spec.md` gains FR6 and its verification row.

## Evidence

![Coincident thumbs dragged down: main moves nothing; here the lower thumb follows](https://raw.githubusercontent.com/vjeux/astryx/2ff402db2ed766013b6da91447e73905d6cd4fe8/slider-8151-coincident.gif)

![Only the dragged thumb's tooltip stays open](https://raw.githubusercontent.com/vjeux/astryx/2ff402db2ed766013b6da91447e73905d6cd4fe8/slider-8151-tooltip.gif)

iOS 26.2 simulator, Mobile Safari, `main` over this branch.

## Scope

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

## Testing

On a range Slider story, with a mouse or a finger:

1. Both thumbs at the maximum, drag down: the lower thumb follows (on `main`, nothing moves).
2. Both in the middle, press the track above them: the upper thumb moves there; below, the lower one.
3. Press on both thumbs and move: the direction picks the thumb; the other's tooltip closes.
4. Repeat step 1 in RTL: mirrored.

Local gates at 1115a21: root build, typecheck, lint, Prettier, `check:repo`, `check:knowledge`, the CLI isolation test (34/34), the Storybook build, Slider's Chromium accessibility suite (7/7), `pnpm test:ui` (16,465 passed), and the node project apart from `story-tree.test.ts` and `cache.test.mjs`, whose failures are known on `main` and have open fixes (#8509, #8520). "Coincident range thumbs" in `Slider.test.tsx` automates each step; with `main`'s `Slider.tsx`, 7 of its 11 cases fail, and the other 4 guard paths that already work, including a drag that began with a track press beside the thumbs, which stays on its thumb.

## Writing rubric results

- R1 narration: none; FR6 states the rule and its consequence in the present tense.
- R2 research: none.
- R3 evidence: FR6's basis is the current source and focused tests.
- R4 rejected alternatives: none added to the record.
- R5 change references: none.
- R6 open questions: none touched.

This branch was successfully deployed

1 active deployment
Preview — f6d3595e Deployed Sep 20, 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.

2 participants