-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Adding a custom directive to theme.extend.screens
breaks other breakpoints.
#13898
Comments
theme.extend.screens
breaks other custom directivestheme.extend.screens
breaks other breakpoints.
...turns out that this seems to be the way to add custom modifiers (instead of in the {
plugins: [
plugin(function ({ addVariant }) {
/** allow to only apply a style on devices that support hover **/
addVariant('hoversupport', '@media (hover: hover) and (pointer: fine)')
}),
]
} I'd still be interested to learn why this disabled all my other breakpoints: {
theme: {
extend: {
screens: {
xs: "360px",
hoversupport: { raw: "(hover: hover) and (pointer: fine)" },
},
},
},
} |
No, the first box should be blue at this screen size. |
Ah, in that case, you'd want to adjust the classes a bit: -<p class="rounded-md bg-green-300 p-2 md:bg-blue-300">This box should be …
+<p class="rounded-md p-2 bg-blue-300">This box should be green on screens… |
but it shouldn't be blue at all screen sizes. Only if at or above ...anyways, it's working fine (as expected) if I use the plugin approach with |
As per #13898 (comment), the viewport is |
Oh my god, you are right! I got confused building the demo. But check this out: It stops working if I use an arbitrary value for the first box, like https://play.tailwindcss.com/b1IyFxPSQk ...then, if you comment out the custom directive in the config, you can see how either the one or the other works as expected. |
That's a known limitation, see #9558 (comment) and #12489 (comment) for details. |
Thank you @wongjn for your help! The links to the comments are great. Thanks again! |
What version of Tailwind CSS are you using?
v3.4.4
What build tool (or framework if it abstracts the build tool) are you using?
What version of Node.js are you using?
For example: v20.11.0
What browser are you using?
Arc
What operating system are you using?
macOS
Reproduction URL
https://play.tailwindcss.com/csci1nIOS9?file=config
Describe your issue
The reproduction URL basically shows my issue. As soon as I add a custom directive
hoversupport
to mytheme.screens.extend
intailwind.config.js
, my breakpoints stop working. Is this intended behavior or a bug? It feels like a bug to me.The text was updated successfully, but these errors were encountered: