Skip to content

Commit

Permalink
Add :popover-open variant
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Nov 7, 2023
1 parent 0b7f27c commit 00e1cea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add spacing scale to `min-w-*`, `min-h-*`, and `max-w-*` utilities ([#12300](https://github.com/tailwindlabs/tailwindcss/pull/12300))
- Add `forced-color-adjust` utilities ([#11931](https://github.com/tailwindlabs/tailwindcss/pull/11931))
- Add `forced-colors` variant ([#11694](https://github.com/tailwindlabs/tailwindcss/pull/11694))
- Add `:popover-open` variant ([#12148](https://github.com/tailwindlabs/tailwindcss/pull/12148))
- [Oxide] New Rust template parsing engine ([#10252](https://github.com/tailwindlabs/tailwindcss/pull/10252))
- [Oxide] Support `@import "tailwindcss"` using top-level `index.css` file ([#11205](https://github.com/tailwindlabs/tailwindcss/pull/11205), ([#11260](https://github.com/tailwindlabs/tailwindcss/pull/11260)))
- [Oxide] Use `lightningcss` for nesting and vendor prefixes in PostCSS plugin ([#10399](https://github.com/tailwindlabs/tailwindcss/pull/10399))
Expand Down
4 changes: 4 additions & 0 deletions src/corePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ export let variantPlugins = {
forcedColorsVariants: ({ addVariant }) => {
addVariant('forced-colors', '@media (forced-colors: active)')
},

popoverOpenVariant: ({ addVariant }) => {
addVariant('popover-open', '&:popover-open')
},
}

let cssTransformValue = [
Expand Down
1 change: 1 addition & 0 deletions src/lib/setupContextUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ function resolvePlugins(context, root) {
variantPlugins['printVariant'],
variantPlugins['screenVariants'],
variantPlugins['orientationVariants'],
variantPlugins['popoverOpenVariant'],
]

return [...corePluginList, ...beforeVariants, ...userPlugins, ...afterVariants, ...layerPlugins]
Expand Down
7 changes: 7 additions & 0 deletions tests/plugins/variants/popoverOpenVariant.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { css, quickVariantPluginTest } from '../../util/run'

quickVariantPluginTest('popoverOpenVariant').toMatchFormattedCss(css`
.popover-open\:flex:popover-open {
display: flex;
}
`)

0 comments on commit 00e1cea

Please sign in to comment.