Fix in-* variant generating invalid CSS with relative arbitrary selectors - #20424
Fix in-* variant generating invalid CSS with relative arbitrary selectors#20424koreahghg wants to merge 2 commits into
in-* variant generating invalid CSS with relative arbitrary selectors#20424Conversation
…ectors `in-*` builds its selector as `:where(…) &`, but unlike `:has()`, `:where()` doesn't accept relative selectors (e.g. `>img`, `+img`, `~img`). This meant `in-[>img]:flex` silently produced an empty, invalid `:where()` that browsers drop the rule for, instead of being rejected like `not-[>img]`, `group-[>img]`, and `peer-[>img]` already are. Add the same relative-selector guard already used by `not`, `group`, and `peer`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughThe Merge Risk: ⚪ Minimal · up to The change prevents invalid relative selectors from generating unusable CSS and adds regression coverage for the affected cases; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The guard precisely rejects selector forms that remain relative and therefore invalid inside the Reviews (1): Last reviewed commit: "Add PR link to changelog entry" | Re-trigger Greptile |
Summary
in-*builds its selector as:where(…) &, but unlike:has(),:where()doesn't accept relative selectors (e.g.>img,+img,~img).This meant
in-[>img]:flexsilently produced:An empty, invalid
:where()that every browser drops the rule for — the utility is silently non-functional.not-*,group-*, andpeer-*already guard against this exact case (they bail out and generate no CSS for a relative arbitrary selector), butin-*was missing the same guard.This adds the same one-line guard already used by
not,group, andpeerto theincompound variant.Test plan
in-*'s existing test block invariants.test.tsassertingin-[>img]:flex,in-[+img]:flex, andin-[~img]:flexall produce no output, mirroring the existingpeer-[>img]:flex/group-[>img]:flexassertions.pnpm vitest run— all 5007 existing tests in thetailwindcsspackage pass, no regressions.