Skip to content

fix(field): pass shade="inherit" to Spinner in input components and Switch - #5250

Open
athz wants to merge 2 commits into
facebook:mainfrom
athz:fix/spinner-inherit-shade
Open

fix(field): pass shade="inherit" to Spinner in input components and Switch#5250
athz wants to merge 2 commits into
facebook:mainfrom
athz:fix/spinner-inherit-shade

Conversation

@athz

@athz athz commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Pass shade="inherit" to <Spinner> in all input-family components and Switch.

Problem

Spinner's default shade reads themeTokens["--color-accent"] from useTheme() — a global JS object — then paints the ring imperatively onto a <canvas> via context.strokeStyle. Nothing in CSS can reach that: not a token remap, not a components entry, not !important. The result is a hardcoded accent-blue spinner that ignores theme overrides entirely.

Solution

shade="inherit" is the only code path that reads the CSS cascade (getComputedStyle(canvas).color), making the spinner respect its parent's color context. This is already the pattern used by Button (line 703).

Affected components

Component Lines
TextInput 462
TextArea 628
DateInput 773
Selector 1517
FileInput 682, 708
Switch 622

Why this matters for theming

With shade="inherit", downstream consumers can control spinner color through normal CSS inheritance — set color on a parent and the spinner follows. Without it, the only lever is the global --color-accent JS token, which is not per-component configurable.

aldentan and others added 2 commits August 20, 2026 01:54
…witch

Spinner's default shade reads themeTokens["--color-accent"] imperatively via
canvas strokeStyle, bypassing CSS entirely. This makes it impossible to theme
the loading indicator through token remaps or CSS overrides.

shade="inherit" is the only branch that reads the cascade via
getComputedStyle(canvas).color, making the spinner respect the parent's
color context — consistent with how Button already uses shade="inherit".

Affected components: TextInput, TextArea, DateInput, Selector, FileInput, Switch.
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 20, 2026 8:58am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 20, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Aug 20, 2026
@github-actions

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

DateInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 529 -
Complexity N/A Very High (85) -
FileInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 651 -
Complexity N/A Very High (102) -
Selector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1575 -
Complexity N/A Very High (168) -
Switch (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 496 -
Complexity N/A Very High (46) -
TextArea (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 423 -
Complexity N/A Very High (65) -
TextInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 330 -
Complexity N/A Very High (55) -

Bundle Size Summary

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

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

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)

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

github-actions Bot added a commit that referenced this pull request Aug 20, 2026
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. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants