Repository navigation
fix(Field): a focusable disabled field shows its focus under forced colors - #9410
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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
nativesurface (the default on a coarse pointer) andbottom-sheetsurface, TimeInput'sbottom-sheetsurface, DateRangeInput and DateTimeInput keep their owndisabledFocusRingwith 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
triggerDisabledFocusmatchinputDisabledFocusStyles.ringexactly; moving these callers, and the date and time ones, onto shared styles inField/inputDisabledFocus.tswould 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. |
There was a problem hiding this comment.
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.
| default: colorVars['--color-border-emphasized'], | ||
| ':has(> [aria-disabled="true"]:focus-visible)': | ||
| colorVars['--color-accent'], | ||
| ':has(> [aria-disabled="true"]:focus-visible)': { |
There was a problem hiding this comment.
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.
PR Analysis Report🔎 Preview ·
|
| 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.
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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]
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
Field/inputDisabledFocus.ts, and each one gives the focused border a@media (forced-colors: active)value ofHighlight. System colors survive forced colors.Current specification
spec:AST-085FR6 (a focusable disabled control shows keyboard focus) andspec:AST-020FR1 (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.tstabs to each disabled field's own control and checks that the field's border changes:maintscfor 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