fix(field): pass shade="inherit" to Spinner in input components and Switch - #5250
Open
athz wants to merge 2 commits into
Open
fix(field): pass shade="inherit" to Spinner in input components and Switch#5250athz wants to merge 2 commits into
athz wants to merge 2 commits into
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsDateInput (@astryxdesign/core) · View in Storybook
FileInput (@astryxdesign/core) · View in Storybook
Selector (@astryxdesign/core) · View in Storybook
Switch (@astryxdesign/core) · View in Storybook
TextArea (@astryxdesign/core) · View in Storybook
TextInput (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. FileInput - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pass
shade="inherit"to<Spinner>in all input-family components andSwitch.Problem
Spinner's default shade reads
themeTokens["--color-accent"]fromuseTheme()— a global JS object — then paints the ring imperatively onto a<canvas>viacontext.strokeStyle. Nothing in CSS can reach that: not a token remap, not acomponentsentry, 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'scolorcontext. This is already the pattern used byButton(line 703).Affected components
Why this matters for theming
With
shade="inherit", downstream consumers can control spinner color through normal CSS inheritance — setcoloron a parent and the spinner follows. Without it, the only lever is the global--color-accentJS token, which is not per-component configurable.