Skip to content
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

group-visited doesn't work in Safari and mobile browsers #16537

Open
Leoyang0717 opened this issue Feb 14, 2025 · 1 comment
Open

group-visited doesn't work in Safari and mobile browsers #16537

Leoyang0717 opened this issue Feb 14, 2025 · 1 comment

Comments

@Leoyang0717
Copy link

Leoyang0717 commented Feb 14, 2025

What version of Tailwind CSS are you using?

v4.0.0

What browser are you using?

This bug appears on Safari and mobile but not in Chrome.

Chrome it's work

Image

Safari

Image

Chrome & Safari mobile

Image Image

Reproduction URL

https://play.tailwindcss.com/TTbwnIDE64

Describe your issue

When upgrading from v3.4.17 to v4.0.0, I encountered an issue on Safari and mobile devices where the visited state does not change the color as expected.

I suspect that :is or :where combined with :visited might not be compatible with Safari or mobile browsers or is it actually not recommended to use group-visited?

v4.0.0 compile result, doesn't work!
.group-visited\:text-red-600 {
  &:is(:where(.group):visited *) {
    color: var(--color-red-600) /* oklch(0.577 0.245 27.325) */;
  }
}

v3.4.17 compile result, work!
.group:visited .group-visited\:text-red-600 {
  color: rgb(220 38 38 ) /* #dc2626 */;
}
@Leoyang0717 Leoyang0717 changed the title group-visited not work in Safari and mobile group-visited doesn't work in Safari and mobile browsers Feb 14, 2025
@davidwebca
Copy link

I stumbled into this too. Considering that the same :is(:where()) kind of selector gets generated for :hover too and that it works (https://play.tailwindcss.com/fMi98ljsf2), I'm thinking maybe it is a :visited security concern in the webkit team. These links offer a brief historical explanation of why :visited is different and lies in computedStyles and could offer a reason why the selector doesn't work (yet?).

https://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/
https://blog.mozilla.org/security/2010/03/31/plugging-the-css-history-leak/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants