Repository navigation
feat(theme): add the focus colour and accessibility modifiers - #365
Merged
alexgrozav merged 2 commits intoOct 29, 2026
Merged
Conversation
Components need one colour for every focus ring, and state hooks the Open Components pages style from: hover only where a pointer can hover, larger hit areas for coarse pointers, and the aria-invalid, readonly and data-loading attributes. color.focus is a reference to color.primary in the light and dark themes, and the focus.outline-color default points at it, so focus rings look the same. Reference colours get no level, shade or tint keys in the preset's return type, matching what it generates. The new modifiers are hover-capable, any-pointer-coarse, aria-invalid, readonly-attr and data-loading; readonly and read-only still emit :read-only. The position-try-fallbacks utility sits beside position-area and ships without defaults.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A project that replaces the default colours and defines no focus colour threw on the new @color.focus default, so useFocusState now references @color.primary there, as it did before. The colour docs now say the focus token colours the global focus ring, and that colors and themes.dark.colors each set one theme.
7 of 13 tasks
This branch was successfully deployed
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.
Description
Adds the shared pieces the component recipes need to meet the Open Components accessibility guidelines, so each component change can stay inside its own recipe folder.
color.focus: a reference to@color.primaryin the light and dark themes, emitted as--color--focus: var(--color--primary). Thefocus.outline-colordefault now points at it, so focus rings look the same as before. Without acolor.focusvariable, the default falls back to@color.primary. Reference colours get no level, shade or tint keys in theuseDesignTokensPresetreturn type, which matches what the preset generates.useModifiersPreset:hover-capable:@media (hover: hover)any-pointer-coarse:@media (any-pointer: coarse)aria-invalid:&[aria-invalid="true"]readonly-attr:&[readonly]. The existingreadonlyandread-onlymodifiers still emit:read-only.data-loading:&[data-loading]position-try-fallbacksutility, besideposition-area, registered inuseUtilitiesPresetwithout defaults. Custom@position-tryrules stay onatRule.colorValues, the modifier pages and the layout utilities page cover the additions, and the focus state page shows the new default.A test compiles a recipe with
&:hover-capable:hoverand&:dark:hover-capable:hoverand checks the nested CSS.Related issue
None on GitHub.
Type of change
Checklist
feat(theme): …)pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm testand everything passespnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/testsdist/,.styleframe/)mainand stays focused in scopeNotes / screenshots
main, so CI runs on the integration PR.pnpm build:nodocs,pnpm lint,pnpm typecheckandpnpm format:checkpass.pnpm testpasses in every package except@styleframe/playground, whosetest/theme.test.tsfails the same 8 tests on the base branch (localStorageis undefined under Node 26), so it isn't from this change.focuscolour, thefocus.outline-colordefault falls back to@color.primary, so those configurations keep building as before.