Skip to content

fix(Field): a focusable disabled field shows its focus under forced colors - #9410

Merged
cixzhang merged 3 commits into
mainfrom
fix/disabled-field-focus-forced-colors
Nov 2, 2026
Merged

cixzhang merged 3 commits into
mainfrom
fix/disabled-field-focus-forced-colors

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Some disabled fields keep their tab stop so keyboard and screen-reader users can reach them and hear why they're disabled (AST-085). For people using forced colors (Windows High Contrast), those fields showed no keyboard focus. That covers a disabled TextInput, TextArea, NumberInput, Typeahead, Tokenizer, Selector or MultiSelector, and a DateInput, TimeInput, DateRangeInput or DateTimeInput on every surface: popover, native and bottom sheet. Now the focused field's border turns the system Highlight color, as enabled fields' does since #9392. Nothing changes outside forced colors.

Problem and solution fit

  • Cause: a disabled field restores the field-focus border and inset while its own control has keyboard focus (AST-085 FR6). Forced colors drop the inset and repaint the border in one system color, so that focus vanished there.
  • Fix: every disabled focus ring now comes from Field/inputDisabledFocus.ts, and each one gives the focused border a @media (forced-colors: active) value of Highlight. System colors survive forced colors.
    • The shared module already held the ring (the control as a direct child) and the nested ring (an inner input). It gains a focus-within ring and an input-focus ring.
    • Ten components used to keep their own copies: Selector, MultiSelector, DateInput, its native and touch fields, TimeInput, its touch field, DateRangeInput, DateTimeInput and its touch field. They now use the shared styles, so the next change happens in one place.
  • This is the same treatment Specs & Decisions approved for enabled fields in fix(Field): a focused field shows its focus under forced colors #9392 (owner decision under AST-020 FR1). The two PRs touch different styles and merge independently.

Current specification

spec:AST-085 FR6 (a focusable disabled control shows keyboard focus) and spec:AST-020 FR1 (WCAG 2.4.7). No records change.

Evidence

Real Chrome 156 with forced-colors emulation, against Storybook built from this head and from main. FieldDisabledForcedColorsFocus.a11y.chromium.spec.ts tabs to each disabled field's own control and checks that the field's border changes:

Story main This PR
TextInput disabled fails (border unchanged) passes
Typeahead disabled (nested ring) fails passes
Selector disabled fails passes
DateInput disabled (its text input) fails passes
TimeInput disabled fails passes
DateInput disabled, native and bottom-sheet surfaces fails passes
TimeInput disabled, bottom-sheet surface fails passes
DateRangeInput disabled, DateTimeInput disabled fails passes
  • MultiSelector has no disabled story; it now uses the same shared ring as Selector.
  • The Field, TextInput, Selector, MultiSelector, Typeahead, DateInput, TimeInput, DateRangeInput and DateTimeInput unit suites pass. On a machine at load average about 100, some long touch-sheet and listbox tests time out at 30–100s; run alone they pass (Selector listbox: 10/10). tsc for core: clean.
  • check:changesets: clean.

LOC

+173 / −143: the shared ring module gains two styles; ten component copies go away; a 95-line Chromium spec.

Scope

  • One change: focusable disabled fields show focus under forced colors.
  • No record change.
  • Public text contains no internal context.

…olors

A disabled field keeps its tab stop and restores the field-focus border and
inset while its control has keyboard focus (AST-085 FR6). Forced colors drop
the inset and repaint the border in one system color, so that focus vanished
there (AST-020 FR1, WCAG 2.4.7). The disabled focus rings (the shared ring and
nested ring, and Selector's, MultiSelector's, DateInput's and TimeInput's)
now paint the focused border in the system Highlight color under forced
colors, as enabled fields do. A forced-colors Chromium spec covers TextInput,
Typeahead, Selector, DateInput and TimeInput.
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 2, 2026
@vercel

vercel Bot commented Nov 2, 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 2, 2026 4:50am UTC

Request Review

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 2, 2026
@astracat-bot

astracat-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 2, 2026, 5:02 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 2, 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.

Changes requested: the forced-colors focus fix works on the five desktop fields it touches, but disabled date and time fields that the changeset and title also cover still show no focus under forced colors.

  • DateInput's native surface (the default on a coarse pointer) and bottom-sheet surface, TimeInput's bottom-sheet surface, DateRangeInput and DateTimeInput keep their own disabledFocusRing with no forced-colors branch, so their border does not change on focus (NativeDateField.tsx:88, TouchDateField.tsx:172, TouchTimeField.tsx:79, DateRangeInput.tsx:103, DateTimeInput.tsx:154, TouchDateTimeField.tsx:163).
  • Selector's and MultiSelector's triggerDisabledFocus match inputDisabledFocusStyles.ring exactly; moving these callers, and the date and time ones, onto shared styles in Field/inputDisabledFocus.ts would fix every surface in one place.

Please extend the fix and the Chromium spec to those surfaces, or narrow the changeset and title to the fields this change covers.

[Automated review]

'@astryxdesign/core': patch
---

[fix] A disabled field that keeps its tab stop (TextInput, TextArea, NumberInput, Typeahead, Tokenizer, Selector, MultiSelector, DateInput, TimeInput) now shows keyboard focus under forced colors, such as Windows High Contrast. Its focus border takes the system Highlight color there, as enabled fields' does. Nothing changes outside forced colors.

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 names DateInput and TimeInput without limiting it to a surface, but DateInput's native (the default on a coarse pointer) and bottom-sheet surfaces and TimeInput's bottom-sheet surface keep unpatched disabledFocusRing copies (NativeDateField.tsx:88, TouchDateField.tsx:172, TouchTimeField.tsx:79), and their border still does not change on focus under forced colors. Please extend the fix there, or narrow this note to the surfaces it covers.

Comment thread packages/core/src/Selector/Selector.tsx Outdated
default: colorVars['--color-border-emphasized'],
':has(> [aria-disabled="true"]:focus-visible)':
colorVars['--color-accent'],
':has(> [aria-disabled="true"]:focus-visible)': {

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.

With this branch, triggerDisabledFocus is identical to inputDisabledFocusStyles.ring in Field/inputDisabledFocus.ts, selector and shadow included. Applying the shared ring here and in MultiSelector, instead of keeping a copy, leaves one place to fix the next time.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 6f364cd

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DateRangeInput · Storybook 75.3 kB (+109 B) · 11.7 kB CSS (+108 B) 631 (−9) — · ✓ · —
TimeInput · Storybook 94.0 kB (+95 B) · 14.3 kB CSS (+122 B) 1,238 (−18) — · ✓ · —
DateTimeInput · Storybook 117.9 kB (+86 B) · 15.8 kB CSS (+127 B) 3,599 (−18) — · ✓ · —
24 more components
Component Size LoC Visual · A11y · RTL
MultiSelector · Storybook 70.7 kB (+108 B) · 15.2 kB CSS (+101 B) 2,704 (−10) — · ✓ · —
DateInput · Storybook 106.2 kB (+92 B) · 15.3 kB CSS (+115 B) 3,580 (−27) — · ✓ · —
Selector 74.8 kB (+104 B) · 15.6 kB CSS (+85 B) — — · ✓ · —
lab/Comments 229.2 kB (+137 B) · 2.5 kB CSS (0) — — · — · —
TextInput 50.6 kB (+70 B) · 10.9 kB CSS (+64 B) — — · — · —
Pagination 83.9 kB (+58 B) · 15.9 kB CSS (+66 B) — — · — · —
Tokenizer 67.5 kB (+50 B) · 17.1 kB CSS (+72 B) — — · — · —
Typeahead 60.4 kB (+62 B) · 11.8 kB CSS (+60 B) — — · — · —
NumberInput 52.9 kB (+58 B) · 11.2 kB CSS (+62 B) — — · — · —
TextArea 45.0 kB (+57 B) · 9.8 kB CSS (+59 B) — — · — · —
richtext/RichTextEditorToolbar 219.3 kB (+79 B) · 454 B CSS (0) — — · — · —
lab/TransferListSelector 78.3 kB (+73 B) · 1.9 kB CSS (0) — — · — · —
lab/MobileTokenizer 98.7 kB (+72 B) · 880 B CSS (0) — — · — · —
lab/ChatEmojiPicker 62.5 kB (+68 B) · 773 B CSS (0) — — · — · —
lab/ChatReactionBar 63.1 kB (+67 B) · 1.1 kB CSS (0) — — · — · —
lab/CommentComposer 99.6 kB (+64 B) · 1.9 kB CSS (0) — — · — · —
lab/EmojiPicker 67.9 kB (+62 B) · 722 B CSS (0) — — · — · —
lab/TransferList 72.1 kB (+61 B) · 1.7 kB CSS (0) — — · — · —
lab/CommentThread 224.0 kB (+54 B) · 2.4 kB CSS (0) — — · — · —
lab/MobilePowerSearch 163.6 kB (+1 B) · 1.2 kB CSS (0) — — · — · —
Field 39.4 kB (0) · 8.3 kB CSS (0) — — · ✓ · —
FieldLabel 33.1 kB (0) · 5.9 kB CSS (0) — — · ✓ · —
SelectorOption 16.5 kB (0) · 5.4 kB CSS (0) — — · — · —
PowerSearch 178.9 kB (−60 B) · 20.5 kB CSS (+53 B) — — · — · —

Package size: @astryxdesign/core 5.83 MB packed (−1.0 kB); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: core 4 rows; run pnpm api:report.

Wide change (7 components): add ci:run-visual or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

CodeBunny on #9410: six date and time disabled focus rings (DateInput's
native and touch fields, TimeInput's touch field, DateRangeInput,
DateTimeInput and its touch field) kept unpatched copies, and Selector's
and MultiSelector's copies matched the shared ring exactly. The shared
module now also holds a focus-within ring and an input-focus ring, each with
the forced-colors Highlight branch, and all ten components use the shared
styles instead of their own copies. The forced-colors Chromium spec adds the
native and bottom-sheet surfaces, DateRangeInput and DateTimeInput.

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

Recommended for approval: every disabled field now takes its focus ring from Field/inputDisabledFocus.ts, and the date and time surfaces flagged earlier (native and bottom-sheet DateInput, bottom-sheet TimeInput, DateRangeInput, DateTimeInput) now show Highlight focus under forced colors. The new Chromium spec fails against the base branch and passes on this head for all ten stories. For awareness only: the disabled opacity dims the focused Highlight border, so focus reads as a hue shift rather than a stronger line.

[Automated review]

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

Recommended for approval: every disabled field now takes its focus ring from Field/inputDisabledFocus.ts, and after the merge from main a keyboard-focus check in Chromium with forced colors still shows the border turn Highlight on all 15 disabled field stories (it stays unchanged on the base branch), with nothing changing outside forced colors. For awareness only: the disabled opacity dims the focused Highlight border, so focus reads as a hue shift rather than a stronger line.

[Automated review]

@cixzhang
cixzhang merged commit ce052bf into main Nov 2, 2026
95 of 98 checks passed
@github-actions
github-actions Bot deleted the fix/disabled-field-focus-forced-colors branch November 2, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 6f364cde Deployed Nov 2, 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