Repository navigation
fix(Field): a focused field shows its focus under forced colors - #9392
Conversation
Forced colors (Windows High Contrast) drop box shadows and repaint author border colors in one system color, so the field-focus treatment (an accent border and an inset shadow) vanished there and a focused field looked the same as one at rest, against WCAG 2.4.7 (AST-020 FR1). Under forced colors, a focused field's border now takes the system Highlight color, in the base wrapper style and in the status border and status focus styles, so Selector and MultiSelector, which apply only the status border, get it too. Nothing changes outside forced colors. A Chromium spec with forced-colors emulation covers TextInput with and without a status and a Selector with a status.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Field | 46.5 kB (0) · 8.3 kB CSS (0) | — | ✗ · ✓ · — |
| FieldLabel | 40.2 kB (0) · 5.9 kB CSS (0) | — | ✗ · ✓ · — |
| MultiSelector | 76.7 kB (+30 B) · 15.1 kB CSS (+24 B) | — | — · — · — |
28 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Selector | 80.9 kB (+28 B) · 15.5 kB CSS (+19 B) | — | — · — · — |
| Tokenizer | 73.6 kB (+10 B) · 17.0 kB CSS (+32 B) | — | — · — · — |
| Pagination | 89.5 kB (+13 B) · 15.8 kB CSS (+21 B) | — | — · — · — |
| lab/TransferListSelector | 76.4 kB (+30 B) · 1.9 kB CSS (0) | — | — · — · — |
| ComplexSelector | 59.7 kB (+4 B) · 11.1 kB CSS (+23 B) | — | — · — · — |
| TextArea | 51.8 kB (+2 B) · 9.8 kB CSS (+23 B) | — | — · — · — |
| PowerSearch | 176.3 kB (+5 B) · 20.4 kB CSS (+19 B) | — | — · — · — |
| DateInput | 103.9 kB (+6 B) · 15.2 kB CSS (+16 B) | — | — · — · — |
| DateTimeInput | 115.7 kB (0) · 15.6 kB CSS (+21 B) | — | — · — · — |
| TextInput | 56.9 kB (+2 B) · 10.9 kB CSS (+19 B) | — | — · — · — |
| TimeInput | 92.4 kB (+3 B) · 14.1 kB CSS (+17 B) | — | — · — · — |
| NumberInput | 59.2 kB (+2 B) · 11.1 kB CSS (+17 B) | — | — · — · — |
| Typeahead | 66.5 kB (+4 B) · 11.7 kB CSS (+14 B) | — | — · — · — |
| DateRangeInput | 73.2 kB (+5 B) · 11.6 kB CSS (+12 B) | — | — · — · — |
| lab/CommentComposer | 98.0 kB (+12 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/MobilePowerSearch | 161.0 kB (+11 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 69.3 kB (+10 B) · 1.1 kB CSS (0) | — | — · — · — |
| lab/TransferList | 70.7 kB (+9 B) · 1.7 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 217.4 kB (+9 B) · 454 B CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 68.8 kB (+8 B) · 773 B CSS (0) | — | — · — · — |
| lab/MobileTokenizer | 96.6 kB (+8 B) · 880 B CSS (0) | — | — · — · — |
| lab/EmojiPicker | 66.6 kB (+7 B) · 722 B CSS (0) | — | — · — · — |
| lab/Comments | 226.7 kB (+6 B) · 2.5 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 273.3 kB (+6 B) · 2.6 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 222.1 kB (+3 B) · 2.4 kB CSS (0) | — | — · — · — |
| InputGroup | 47.1 kB (+2 B) · 8.4 kB CSS (0) | — | — · — · — |
| FileInput | 57.7 kB (0) · 10.7 kB CSS (0) | — | — · — · — |
| lab/ListInput | 78.6 kB (0) · 1.6 kB CSS (0) | — | — · — · — |
Visual changes: 2 snapshots in 1 component
A change is a question for the reviewer, not a failure.
| Component · story | Before | After | Diff |
|---|---|---|---|
| Field · Default (neutral, light) | ![]() |
![]() |
![]() |
| Field · Default (neutral, dark) | ![]() |
![]() |
![]() |
Package size: @astryxdesign/core 5.69 MB packed (+353 B); no new dependencies.
API changes: core +0 · ~3 · −0
Committed API report behind this build: core 4 rows; run pnpm api:report.
3 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| ~ | core |
. · Values · const inputStatusBorderStyles |
const inputStatusBorderStyles: Readonly<{ readonly warning: Readonly<{ readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "var(--color-text-warning)"> }>; readonly error: Readonly … #a9ac1cbc → const inputStatusBorderStyles: Readonly<{ readonly warning: Readonly<{ readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "var(--color-text-warning)" | "Highlight"> }>; readonly e … #739ff723 |
import {inputStatusBorderStyles} from '@astryxdesign/core' |
| ~ | core |
. · Values · const inputStatusFocusWithinStyles |
const inputStatusFocusWithinStyles: Readonly<{ readonly warning: Readonly<{ readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "var(--color-text-warning)"> }>; readonly error: Readonly … #a9ac1cbc → const inputStatusFocusWithinStyles: Readonly<{ readonly warning: Readonly<{ readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "var(--color-text-warning)" | "Highlight"> }>; readonly e … #739ff723 |
import {inputStatusFocusWithinStyles} from '@astryxdesign/core' |
| ~ | core |
. · Values · const inputWrapperStyles |
const inputWrapperStyles: Readonly<{ readonly base: Readonly<{ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">; readonly position: stylex.StyleXClassNameFor<"pos … #2e7e1cc8 → const inputWrapperStyles: Readonly<{ readonly base: Readonly<{ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">; readonly position: stylex.StyleXClassNameFor<"pos … #90a96087 |
import {inputWrapperStyles} from '@astryxdesign/core' |
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
The forced-colors focus fix works for enabled fields in Chromium, but approval waits on an engineering owner decision and one wording fix. No current spec record chooses a 1px Highlight border as the forced-colors focus treatment for Field inputs (spec:AST-020 FR1, WCAG 2.4.7, only requires a visible indicator), and none decides the resulting type changes to the exported inputWrapperStyles, inputStatusBorderStyles and inputStatusFocusWithinStyles. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, or names the record that should state the treatment, and the author may do so if they are an engineering owner. Separately, disabled fields stay focusable and must show keyboard focus (spec:AST-085 FR6) but still show none under forced colors, so either add the Highlight branch to the disabled focus rings (inputDisabledFocus.ts and the Selector, MultiSelector, DateInput and TimeInput disabled styles) or narrow the changeset to enabled fields.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Field inputs (TextInput, TextArea, NumberInput, Selector, MultiSelector, Typeahead, Tokenizer, and the date and time inputs) now show keyboard focus under forced colors, such as Windows High Contrast. Forced colors drop the inset focus shadow and repaint every border in one system color, so a focused field looked the same as one at rest. A focused field's border now takes the system Highlight color there, with or without a status. Nothing changes outside forced colors. |
There was a problem hiding this comment.
Disabled fields stay focusable and must show keyboard focus (spec:AST-085 FR6), but under forced colors they still show none: inputDisabledFocusStyles.ring/.nestedRing and the Selector, MultiSelector, DateInput and TimeInput disabled focus styles replace the base border without the Highlight branch. Either add the branch there, or narrow this note to enabled fields.
CodeBunny on #9392: focusable disabled fields keep their own focus styles, which have no forced-colors branch yet, so the note now says enabled fields.
|
/approve-spec ec3a32a |
There was a problem hiding this comment.
The forced-colors focus fix is ready: enabled Field inputs now show a Highlight border at keyboard focus in High Contrast, and an engineering owner confirmed that treatment on this head. One optional follow-up: a Selector or MultiSelector with a status now also shows that border after a mouse pick, while one without a status does not, because the status border style is applied after the pointer-restored focus suppression. A status-keyed suppression applied after the status border, plus a mouse-pick case in the Chromium spec, would keep the two consistent.
[Automated review]
| * Keyed by InputStatusType. | ||
| * Keyed by InputStatusType. Under forced colors a focused field's border is | ||
| * Highlight, as in the base style, for wrappers that apply no status focus | ||
| * style of their own (Selector, MultiSelector). |
There was a problem hiding this comment.
For Selector and MultiSelector this branch also replaces selectorPresentationStyles.pointerRestoredFocus, which they apply earlier in the same style list, so under forced colors a status trigger shows Highlight after a mouse pick while a trigger without a status does not. A status-keyed suppression applied after the status border when the focus ring is suppressed would keep them consistent.






User impact
People who use forced colors (Windows High Contrast, and some low-vision setups) couldn't see which field had keyboard focus. A focused TextInput, TextArea, NumberInput, Selector, MultiSelector, Typeahead, Tokenizer, or date or time input looked exactly like one at rest, with or without a status. Now a focused field's border turns the system Highlight color. Nothing changes outside forced colors.
Not in this PR: disabled fields stay focusable (AST-085), but their own focus styles (the shared disabled focus ring, and Selector's, MultiSelector's, DateInput's and TimeInput's) have no forced-colors branch yet. That's tracked as a separate fix.
Problem and solution fit
box-shadow. Forced colors drop every box shadow and repaint author border colors in one system color, so both parts vanished there.@media (forced-colors: active), a focused field's border isHighlight. System colors survive forced colors, so this is the one edge change that shows.Current specification
spec:AST-020FR1 makes WCAG 2.2 AA the baseline, and 2.4.7 (Focus Visible) applies under forced colors as under any other colors. Specs & Decisions ruled this a defect decided by FR1. No record changes.Evidence
Real Chrome 156 with forced-colors emulation, against Storybook built from this head and from
main(a7d0b3f).FieldForcedColorsFocus.a11y.chromium.spec.tstabs to each field and checks that the field's edge changes:mainmain's build in this offline rig: the Field label audit needs a git checkout, and Selector combobox "open" and "busy" fail onmaintoo.check:changesets: clean.LOC
+142 / −9: about 40 style lines, most of them the three status types, and a 95-line Chromium spec.
Scope