Stop nesting states under pseudo-elements (#219)

Tailwind emits variants used inside a pseudo-element rule (hover:, focus-visible:, active:, dark:, not-dark:, data-*, rtl:) as nested &:state rules. Native CSS nesting can't match those, so they never applied in the unminified CDN files. Move each state before the pseudo-element instead.
This commit is contained in:
Grug
2026-10-23 18:09:41 +08:00
committed by GitHub
parent 33d0eb9eb2
commit 275782b7e5
10 changed files with 352 additions and 32 deletions
+42 -3
View File
@@ -1377,15 +1377,54 @@
}
:is(.field > input[type='range'], .input[type='range'])::-webkit-slider-thumb {
@apply border-ring ring-ring/50 relative size-3 rounded-full border bg-white transition-[color,box-shadow] hover:ring-3 focus-visible:ring-3 active:ring-3 -mt-[calc((var(--slider-thumb-size)-var(--slider-track-height))/2)] focus-visible:outline-hidden;
@apply border-ring ring-ring/50 relative size-3 rounded-full border bg-white transition-[color,box-shadow] -mt-[calc((var(--slider-thumb-size)-var(--slider-track-height))/2)];
}
:is(.field > input[type='range'], .input[type='range'])::-moz-range-thumb {
@apply border-ring ring-ring/50 relative size-3 rounded-full border bg-white transition-[color,box-shadow] hover:ring-3 focus-visible:ring-3 active:ring-3 focus-visible:outline-hidden;
@apply border-ring ring-ring/50 relative size-3 rounded-full border bg-white transition-[color,box-shadow];
}
:is(.field > input[type='range'], .input[type='range'])::-ms-thumb {
@apply border-ring ring-ring/50 relative size-3 rounded-full border bg-white transition-[color,box-shadow] hover:ring-3 focus-visible:ring-3 active:ring-3 focus-visible:outline-hidden;
@apply border-ring ring-ring/50 relative size-3 rounded-full border bg-white transition-[color,box-shadow];
}
/* States go before the thumb pseudo-element so they still apply with native CSS nesting. */
@media (hover: hover) {
:is(.field > input[type='range'], .input[type='range']):hover::-webkit-slider-thumb {
@apply ring-3;
}
:is(.field > input[type='range'], .input[type='range']):hover::-moz-range-thumb {
@apply ring-3;
}
:is(.field > input[type='range'], .input[type='range']):hover::-ms-thumb {
@apply ring-3;
}
}
:is(.field > input[type='range'], .input[type='range']):focus-visible::-webkit-slider-thumb {
@apply ring-3 outline-hidden;
}
:is(.field > input[type='range'], .input[type='range']):focus-visible::-moz-range-thumb {
@apply ring-3 outline-hidden;
}
:is(.field > input[type='range'], .input[type='range']):focus-visible::-ms-thumb {
@apply ring-3 outline-hidden;
}
:is(.field > input[type='range'], .input[type='range']):active::-webkit-slider-thumb {
@apply ring-3;
}
:is(.field > input[type='range'], .input[type='range']):active::-moz-range-thumb {
@apply ring-3;
}
:is(.field > input[type='range'], .input[type='range']):active::-ms-thumb {
@apply ring-3;
}
}