-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Hover styles don't apply in Chrome 133 #16416
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
Comments
Could be related to #16150 (comment) |
@benweier-riotinto Hey! I am able to run your repro on Chrome 133 and |
I have exactly the same problem on Chome 133 with my Dell laptops (Precision 3580 and Latitude 5450) and both have no touch functionality at all. |
I too have the exact same issue, in chrome (133.0.6943.60) only, firefox works fine, and tablet mode is disabled. Running windows 10. |
All we do from the Tailwind CSS side is to prefix all One thing you can do to work around this is to overwrite the @custom-variant hover (&:hover); However, you really should not have to. The |
The MDN page test works, as does non-tailwind websites. I've tried disabling all extensions and running in incognito mode. Havn't really fiddled with any dev tools settings, the same bug whether or not dev tools is open or not. |
Does it show a black background or a yellow background when hovering? There's nothing that Tailwind CSS does differently from that MDN example with the |
Ah, indeed it shows the yellow one. |
apparently if the browser is based on chromium it doesn't work, I already tried it with the brave browser the only one that worked is firefox. |
I ran into this exact issue that @benweier-riotinto originally posted. None of the hover events were compiling in the Chrome dev tools for me as well. Also note that Tailwind 3.x was working perfectly fine. It happens in all of the latest browsers for me: Chrome 133.0.6943.60, Firefox 135.0 and Edge 133.0.3065.59. I have Dell XPS 9310 2-in-1 with touchscreen. The issue at hand is the touchscreen functionality on my laptop. I tried disabling it on the OS-level: disabling the HID touchscreen device in the device manager, disabling touch input via the Control Panel, but nothing worked. I went into the BIOS and disabled the touchscreen there and everything worked 100% fine for me in all browser after that. If I turn back on the touchscreen in the BIOS, none of the hover events work any more. If you have a touchscreen laptop, it must be disabled at the BIOS-level, not the OS-level. Something in Tailwind 4.x keeps instructing web browsers not to enable any sort of hover events. Again, TW 3.x hover events works perfectly fine. So this seems to be something related to TW 4.x. Just not sure where or what causes this. Hopefully this helps anyone that has this issue. |
@duprayae179dpl @Angel-Guxman @sheepa @wunderlichh @benweier-riotinto can I ask you to please try hovering over the elements in this playground and report back which of these do work and which don't for you? That would be fantastic: |
@philipp-spiess only the first one works |
Just FYI everyone there is a regression tracked on Chromium here. https://issues.chromium.org/issues/394519480 Causing issues with If you are using Would recommend considering removing |
All hovering works for me if I disable the touchscreen at the BIOS level. |
@davidfishlock Is there any documentation for disabling/removing |
Per the TW 4.x docs, looks like this needs to be added using the |
@duprayae179dpl oh only just realised that Tailwind 4 bakes in the As per @philipp-spiess comment here
Should do the trick for Tailwind 4 users until Chromium fix this. |
@davidfishlock @philipp-spiess I can confirm that the custom variant code above works on my end and does not populate the
|
@philipp-spiess hey, only the first one works. |
Only the first example works for me. The MDN example also only shows a yellow background instead of black. Using the hover custom variant override worked a treat, and according to the issue tracker it looks like the Chrome regression has been addressed in |
I'm using a regular laptop without any touch support. The problem goes away after adding this override to my css:
Windwos 11 |
Hey folks! As @davidfishlock pointed out in #16416 (comment): There is currently a P0 Chrome bug affecting the use of hover media queries that breaks hover stylings. This will be fixed in Chrome |
@philipp-spiess There seems to be two separate issues here:
My guess here is that all browsers have the same bug as Chrome and will report touchscreen devices as mobile only, thus disabling hover events. Even if Chrome fixes the issue on their end, it will persist in other browsers. |
@duprayae179dpl I am not sure if your issue and the one reported by @benweier-riotinto are the same since the initial issue comment says that it works with Firefox and Safari and your commend says it does not work in any browser. The way If you indeed still have an issue in other browsers as well, it would be great if you could create a new GitHub issue and also test it against the playground I've added in the comment above here. Thank you! |
@philipp-spiess I completely mixed up OP's issue from another thread with the same issue. You are 100% correct on this. My issue is completely separate from this, but with a similar outcome that affects all browsers on my end. I did some more testing on my end and came to a conclusion that this seems to be intended behaviour... However, I just find it really odd. I'll explain my setup and issue... I have a 2-in-1 Dell XPS 9310 laptop. It's a great little device. My setup at home and work has it folded backwards (not all the way) and it sits on a stand and acts as a 2nd monitor below my widescreen monitor. I have a docking station with a mouse and keyboard connected to it, so it's a full-on deskltop setup that I have. However, because the screen is bent backwards (tent mode) to sit on the stand, this kicks the laptop into tablet mode, even though my mouse and keyboard still work. And this is where my issue is on all browsers. As soon as I unbend the laptop back to a proper laptop orientation, hover events work as intended on all browsers. So my issue here is completely unrelated and I apologize for putting the initial topic off track. It was just such an edge case, I couldn't figure it out for the life of me. So this thread essentially walked me through undertsanding the issue fully. My only issue now is that I need to let Tailwind know that I'm on a desktop device and that the hover events should be working even with my laptop in tent mode. I'm sure I'm not the only one with the setup above, so this issue would affect that specific scenario. I think Tailwind should be checking if there is a pointer device (not touch) and enable hover events based off that. I think there's a media query to test for specific types of pointers. I might be wrong in my thoughts here, so please feel free to chime in. |
@duprayae179dpl if your device is in tablet mode then the screen will generally be considered the primary pointer. You might get more luck out of using a custom variant with In that case you'll just need to rely on the pseudo class as recommended previously. You can see what support is reported here. https://codepen.io/dukecroc/pen/dyzjmBB Generally though, if you aren't using the device as a tablet it is best to turn off the tablet mode. |
Can confirm this fix. Before implementation, Tailwind v4 only works with Firefox 135.0 (64-bit). (Laptop don't have touch support) Edge: Version 133.0.3065.59 (Official build) (64-bit) |
This should be fixed in Chrome 133.0.6943.99 which is available now 👍🏻 Try upgrading and with any luck everything should work as expected now. |
Confirming that the latest Chrome update fixes this |
The newest version of Chrome works perfectly fine. However, the latest version of Edge still has that bug (sadly it is my main browser). The good news is that one line Edit: my laptop does not support touch screen at all. |
@custom-variant hover (&:hover); Confirming this allows a "tap" to register as hover and apply styles on mobile iOS 👍 |
Given that we have confirmation that the latest Chrome update fixes the issue, I'm going to close this issue now. Thanks everyone for helping test this! @duprayae179dpl Yeah I understand your setup now and your frustration and it's definitely something we're thinking about. A good next step would still be if you could try to go to this playground and report back which of the media queries show a hover for your device and which won't. Thank you! |
@philipp-spiess the touchscreen (actually it's not about a touchscreen PC but one with built-in keyboard detached or flipped) mentioned by @duprayae179dpl is a long-standing Chromium-only bug that doesn't seem to be high on their priority list. This issue is from 2023 is here and there were older ones (iirc). I've been hitting it (as a user) for 10+ years here and there (most notably Spotify's desktop client) but it's going to get a lot worse now that Tailwind relies on this buggy behavior. |
Sorry for the delayed response. Work got in the way this week. @davidfishlock I'm attaching a screenshot from your CodePen link. @philipp-spiess Only the first element in your playground hovers for me. The remaining 3 elements do nothing. I also wanted to note that the screenshots above are using Chrome 133.0.6943.99. I just updated it to be sure. I can also confirm that I'm still having the hover issue with the latest Chrome release. My issue is definitely not the same issue that the other Chrome-only users are having here. |
@duprayae179dpl your screenshot shows you that your device reports no hover capability whatsoever when it is in tablet mode. As I recommended previously, it's best to turn off tablet mode when using it as a desktop if you wish it to behave like a desktop. If you want the css to apply hover regardless of the support reported, you should use the custom variant provided. But that will likely present the issue of hover states sticking when you use it as a tablet. |
Uh oh!
There was an error while loading. Please reload this page.
What version of Tailwind CSS are you using?
4.0.4 / 4.0.5 / 4.0.6
What build tool (or framework if it abstracts the build tool) are you using?
Vite with plugin
What version of Node.js are you using?
22.13.1
What browser are you using?
Chrome 132 / 133
Edge 132 / 133
Brave 132 / 133
Firefox 134 / 135
What operating system are you using?
Windows 11. Note that I'm on a touch-enabled device but am not using (and have/will never use) the tablet/touch mode.
Reproduction URL
https://play.tailwindcss.com/ejMhEzAx6k
https://codesandbox.io/p/devbox/59ynks
Describe your issue
Using
hover:
with any Chromium 133 based browser does not apply hover styles whereas it does work in Chromium 132 based browsers.The CSS of my project (with custom colour variables) looks like this in devtools
Chrome 133:

Edge 132:

Firefox 135:

The text was updated successfully, but these errors were encountered: