Skip to content

Handle vendor-prefixed selector functions in custom variants - #20486

Open
OllieinCanada wants to merge 1 commit into
tailwindlabs:mainfrom
OllieinCanada:codex/issue-20483
Open

Handle vendor-prefixed selector functions in custom variants#20486
OllieinCanada wants to merge 1 commit into
tailwindlabs:mainfrom
OllieinCanada:codex/issue-20483

Conversation

@OllieinCanada

Copy link
Copy Markdown

Fixes #20483.

What changed

  • parse :-moz-any() and :-webkit-any() arguments as selector lists, matching their standard :is() counterpart
  • allow nesting replacement to substitute & inside these legacy selector functions
  • cover both vendor-prefixed parser forms and the reported @custom-variant firefox (:-moz-any(&)) compilation path

Why

The selector parser treated unknown function arguments as opaque values. After the nesting changes in #20124, that meant the & inside :-moz-any(&) could not be replaced and the custom variant was emitted as a descendant selector instead.

These two vendor-prefixed functions are legacy aliases for selector-list matching, so handling them alongside :is() keeps the change narrowly scoped.

Validation

  • reproduced the regression on current main: .firefox\\:underline :-moz-any(:scope)
  • confirmed the new assertions fail when only the parser change is reverted
  • vitest run packages/tailwindcss/src/index.test.ts packages/tailwindcss/src/selector-parser.test.ts — 299 tests passed
  • Prettier check passed for all changed files
  • tailwindcss production build passed, including ESM, CJS, and declaration output

@OllieinCanada
OllieinCanada requested a review from a team as a code owner September 11, 2026 15:29
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the parser and downstream nesting behavior aligned and covered by focused tests.

Reviews (1) · Last reviewed commit: "Handle vendor-prefixed selector function..."

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f48b5db8-dd9e-4cce-8f38-98d3a553ccf5

📥 Commits

Reviewing files that changed from the base of the PR and between 41d9cae and 03c029e.

📒 Files selected for processing (3)
  • packages/tailwindcss/src/index.test.ts
  • packages/tailwindcss/src/selector-parser.test.ts
  • packages/tailwindcss/src/selector-parser.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


Walkthrough

The selector parser now parses :-moz-any(...) and :-webkit-any(...) arguments as selector lists. Tests cover the resulting parser nodes and verify that the body-less @custom-variant firefox (:-moz-any(&)); syntax generates the expected firefox:underline CSS.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 03c02

The vendor-prefixed custom-variant regression is covered by passing parser and compiler tests, so no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: support for vendor-prefixed selector functions in custom variants.
Description check ✅ Passed The description directly explains the parser fix, nesting replacement behavior, affected custom variant syntax, regression cause, and validation results.
Linked Issues check ✅ Passed The change addresses issue #20483. selector-parser.ts now parses :-moz-any() and :-webkit-any() contents as selector lists. The parser test covers & and .foo. The `@custom-variant firefox (:…
Out of Scope Changes check ✅ Passed The pull request changes only selector parsing and tests for vendor-prefixed selector functions and the linked custom-variant compilation path. These changes directly support issue #20483 and contain …

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@custom-variant firefox (:-moz-any(&)); breaks in 4.3.3

1 participant