A utility-first CSS framework for rapid UI development.
Canonicalization: migrate `[&:has(…)]` to `has-[…]` variant (#19991)
This PR improves the canonicalization around arbitrary variants containing `[&:has(…)]`, by converting them to `has-[…]`. Essentially when you have a variant, with `&:has(…)`, we will convert it: ```diff - [&:has([role=checkbox])]:flex + has-[[role=checkbox]]:flex ``` This also means that if the arbitrary selector inside of the `&:has(…)` can be converted to something that aligns with known variants, then we will do that as well: ```diff // `data-*` can be hoisted outside of the arbitrary value - [&:has([data-slot=description])]:flex + has-data-[slot=description]:flex // `aria-visible="true"` can be entirely replaced by `aria-visible` - [&:has([aria-visible="true"])]:flex + has-aria-visible:flex ``` Noticed this while looking into: https://github.com/tailwindlabs/tailwindcss-intellisense/issues/1562 ## Test plan 1. Added additional tests for this use case 2. Existing tests still pass
R
Robin Malfait committed
73f3a6a74336b5d74ff69cae5465714650f1d2e3
Parent: b944961
Committed by GitHub <noreply@github.com>
on 4/29/2026, 12:20:11 PM