Repository navigation
fix(theme-neutral): strengthen default control boundaries - #7662
rubyycheung wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
5ad5d55 to
8ffd763
Compare
PR Analysis Report
No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression107 of 478 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 87 more. Generated by PR Enrichment workflow | View full report |
There was a problem hiding this comment.
Changes requested. Neutral's resting field, selector, checkbox and radio edges do need 3:1, and this head gets them there (3.15:1 light, 3.38:1 dark). Since this pull request opened, though, the repository has decided that form controls get their own border role instead of a stronger shared emphasized border, and the shared route also breaks ProgressBar contrast.
- Regression:
architecture:theme-tokensDEC-2 now gives control edges their own--color-border-controlrole and rejects raising--color-border-emphasizedto 3:1, so keep the emphasized role at Neutral 85/35 and set--color-border-controlto Neutral 55/50 in both theme copies (Neutral 60 is only 2.79:1 on the light page body), or fold this work into #11658, which makes that change. - Neutral's ProgressBar track follows the emphasized role, so the default accent bar drops from 3.08:1 to 1.45:1 against its track in light mode and a light
neutralbar's fill matches its track, below the 3:1 every enabled fill must keep (component:ProgressBarDEC-3). - Newly live check:
scripts/check-input-boundary-contrast.test.mjswrites its own colour parsing and contrast maths instead of usingpackages/core/src/theme/contrast.tsandpackages/core/src/utils/color.ts(orscripts/lib/theme-contrast.mjsonmain), and that copy still passes with an 8%-alpha or#eee8edge and never measures a control's real fill. - Newly live check: the description says disabled treatments stay outside the change, but the disabled field edge (
packages/core/src/Field/inputStyles.stylex.ts:70) and the hover rings take the new value, so correct that claim and the changeset when the change moves to the control role.
Rebasing also means regenerating both palette-ref copies and the stop count, since they conflict with main.
Claims and files checked
Review mode: full; reason: recipe-changed (many rules)
- Claims
- Changeset: Neutral's control edge reaches at least 3:1 against its surface: verified for field shells and indicators (3.15:1 light, 3.38:1 dark); the InputGroupText addon edge is 2.79:1 against its own fill.
- Changeset: text fields, selectors, file inputs, input groups and unchecked checkbox and radio indicators use Neutral 60 light and Neutral 50 dark: verified (
neutralTheme.ts:177and the CLI copy). - Changeset: no behavior or public API change: public API verified unchanged; the note leaves out the Switch and ProgressBar tracks and the other surfaces that darken.
- Description: these edges are too faint at rest: verified (1.48:1 light, 1.94:1 dark on the base; the new guard fails there).
- Description: Neutral 60 and Neutral 50 are the lightest named stops that reach 3:1 on the control surface: verified (Neutral 65 is 2.68:1, Neutral 45 is 2.80:1).
- Description: the emphasized-border role already reaches these controls: verified.
- Description: only Neutral changes, and Core and the other six themes are unchanged: verified.
- Description: the correction is already settled by objective accessibility authority: false; the 3:1 floor is settled, but the repository's theme-token decision picks a separate control role.
- Description: status, focus, checked, disabled, secondary and ghost treatments stay outside the change: false for the disabled field edge, and the hover rings change too.
- Description: the guard resolves 16 control targets in both modes with no allowlist: true as written, but every target uses one assumed colour pair and translucent edges pass.
- Description: the palette projection and CLI theme files are updated and the focused tests pass: verified (96 stops in sync; 34 tests pass).
- Description: the before and after image shows the changed pixels: not checked, as the image host was out of reach; this review's own captures show the control edges and the ProgressBar track.
- Files
.changeset/control-boundary-contrast.md: the disabled-claim and changeset finding.packages/themes/neutral/src/neutralTheme.ts: the control-role and ProgressBar findings.packages/cli/assets/templates/themes/neutral/neutralTheme.ts: identical to the runtime copy; same findings.packages/themes/neutral/src/neutralPaletteRefs.generated.ts: in sync at this head; conflicts withmain.packages/cli/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts: identical to the runtime copy; conflicts withmain.scripts/check-input-boundary-contrast.test.mjs: the guard finding.scripts/generate-neutral-palette-refs.test.mjs: consistent with this head (96 stops); conflicts withmain.
| withAlpha(neutral.dark[100], '1A'), | ||
| ], | ||
| '--color-border-emphasized': [neutral.light[85], neutral.dark[35]], | ||
| '--color-border-emphasized': [neutral.light[60], neutral.dark[50]], |
There was a problem hiding this comment.
Neutral also aliases the ProgressBar track to this role ('progress-bar': {base: {'--color-background-muted': 'var(--color-border-emphasized)'}}, lines 442-445), so the track moves to Neutral 60/50 while the fills stay put. In light mode the default accent fill drops from 3.08:1 to 1.45:1 against the track, and a neutral-variant fill (--color-text-disabled, also Neutral 60) becomes identical to it. Consider pinning that override to the previous stops, for example a light-dark() value built from neutral.light[85] and neutral.dark[35], here and in the CLI template copy. The Switch off-track alias at lines 436-440 also moves; that one improves contrast, but it is worth naming in the changeset.
| function rgb(hex) { | ||
| let h = hex.slice(1); | ||
| if (h.length === 3) h = [...h].map(c => c + c).join(''); | ||
| return [0, 2, 4].map(index => parseInt(h.slice(index, index + 2), 16)); |
There was a problem hiding this comment.
rgb() ignores the alpha byte of an 8-digit hex and returns NaN for a 4-digit hex, and a NaN ratio passes both assertions. With the boundary set to withAlpha(neutral.light[0], '14') (the form Neutral uses for --color-border) or '#eee8', both tests still pass. Failing on anything that is not an opaque 3- or 6-digit hex, or compositing alpha over the fill, would make the guard catch these.
| base.borderColor ?? 'var(--color-border-emphasized)', | ||
| modeIndex, | ||
| ); | ||
| const surface = resolve( | ||
| base.backgroundColor ?? 'var(--color-background-surface)', |
There was a problem hiding this comment.
None of the 16 targets has a Neutral override, so every row falls back to this same assumed pair. The real fills differ: InputGroupText paints --color-background-muted (packages/core/src/InputGroup/InputGroupText.tsx:36), where the new boundary is 2.79:1 in light mode. Neutral's ProgressBar and Switch aliases to this role are not covered at all. Reading each target's actual fill token and adding those alias pairs would let the guard observe what it claims.
| '@astryxdesign/theme-neutral': patch | ||
| --- | ||
|
|
||
| [fix] Raise Neutral’s default form-control boundary to at least 3:1 against its surface. Text fields, selectors, file inputs, input groups, and unchecked checkbox/radio indicators use Neutral 60 in light mode and Neutral 50 in dark mode without changing behavior or public API. |
There was a problem hiding this comment.
The same Neutral value also restyles the Switch off track, the ProgressBar track, and the role's shared details (strong Divider, Blockquote rule, Kbd edge, TreeList branch lines, hover underlines). Naming them, or describing this as a change to Neutral's emphasized-border role, would keep the release note accurate.
|
/approve-spec 8ffd763 |
User impact
Neutral’s default TextInput, TextArea, Selector, FileInput, InputGroup, Checkbox, and Radio boundaries are too faint to reliably identify at rest. This changes Neutral to the lightest named palette stops that reach 3:1 against its control surface: Neutral 60 in light mode and Neutral 50 in dark mode.
Visual authority
The existing
--color-border-emphasizedrole already reaches these Neutral controls. This draft changes only Neutral’s mapping; Core and the other six first-party themes remain unchanged.Before and after
The matched browser capture shows the current and proposed values across TextInput, Selector, CheckboxInput, RadioList, and FileInput. It also names the other Neutral details that intentionally share the emphasized-border role.
State matrix
Scope
Testing