fix: restore input focus ring (patch tailwindcss-react-aria-components not-* variants)#172
Merged
Merged
Conversation
…onents The plugin emits native state variants (invalid, focus, disabled, …) as two sibling rules — one for RAC elements ([data-rac][data-invalid]) and one for the native pseudo-class (:not([data-rac]):invalid). Tailwind's not-* compound walker bails out on multi-rule variants, so every not-invalid: utility silently emitted no CSS. The input field relies on focus:not-invalid:border-border-focus and focus:not-invalid:ring-border-focus-muted, so focused inputs lost their blue focus border and ring after the move to the official react-aria packages. Patch getSelector to collapse the two branches into a single :is() selector, keeping specificity at (0,1,0) via :where(), so not-* negation works again. Backports adobe/react-spectrum#9974. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pre-existing formatting drift flagged by oxfmt --check; reordering Tailwind classes in the source string is behavior-neutral (Tailwind decides precedence by its own internal sort, not class-attribute order). Keeps CI green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
The regression
Focused text inputs stopped showing the blue focus ring (and the blue focus border). This regressed when the vendored react-aria was swapped for the official packages, which brought a newer
tailwindcss-react-aria-componentsplugin.Root cause
The input's focus styles depend on the
not-invalid:variant:The
tailwindcss-react-aria-componentsplugin emits each native state variant (invalid,focus,disabled, …) as two sibling rules — one for React-Aria elements and one for the native pseudo-class:Tailwind's
not-*compound walker bails out on variants that produce more than one rule, so everynot-invalid:utility silently emitted no CSS. Confirmed against the live stylesheet:invalid:→ 10 rules,not-invalid:→ 0 rules. With nofocus:not-invalid:*rules, the focused input had no focus border and--tw-ring-colorwas never set → no ring.The fix
Patch the plugin (
pnpm patch) to collapse the two branches into a single:is()selector, sonot-*negation works again::where()keeps specificity at(0,1,0), so the cascade is unchanged. Hover keeps its@media (hover: hover)wrapper (itsnot-hover:stays unsupported, matching native Tailwind). This backports adobe/react-spectrum#9974.Verification
After patching, with real keyboard focus (foreground browser, since a backgrounded tab drops react-aria focus state):
rgb(55,55,62)(grey field)nonergb(59,122,186)(focus blue)rgb(35,74,112) 0 0 0 2px(2px blue ring)not-invalid:rules in the compiled CSS: 0 → 6.CI (all green locally)
pnpm lint:ws· ✅pnpm check· ✅pnpm typecheck· ✅pnpm test· ✅pnpm build:registry(no drift)Notes
www/src/registry/ui/input/styles.tshas a second commit applying oxfmt's class ordering — pre-existing formatting drift onmainthatoxfmt --checkflags. Reordering Tailwind classes in the source string is behavior-neutral (Tailwind decides precedence by its own internal sort). Split out so it's easy to see it's unrelated to the fix.not-invalid:to work in their own Tailwind build, untiltailwindcss-react-aria-componentsships the fix.🤖 Generated with Claude Code