Skip to content

Support @media(hover) (needed for tailwind hover:) #252

Closed

Description

@liaoliao666

I'm currently using Tailwind and Blitz, and I've discovered that the following doesn't work:

button { class: "hover:bg-amber-500", "home" }
 .hover\:bg-amber-500 {
    &:hover {
      @media (hover: hover) {
        background-color: var(--color-amber-500);
      }
    }
  }

Activity

  1. changed the title [-]Support class like <code>hover:bg-amber-500</code>[/-] [+]Support class like `hover:bg-amber-500`[/+] on Aug 31, 2025
  2. nicoburns commented on Sep 1, 2025

    @nicoburns
    Member

    I think it's @media(hover: hover) we don't support. Everything else there ought to work.

  3. changed the title [-]Support class like `hover:bg-amber-500`[/-] [+]Support `@media(hover)` (needed for tailwind `hover:`)[/+] on Sep 1, 2025
  4. liaoliao666 commented on Sep 1, 2025

    @liaoliao666
    Author

    but I changed the CSS to the following and it worked

     .bg-amber-500 {
        &:hover {
          @media (hover: hover) {
            background-color: var(--color-amber-500);
          }
        }
      }
    ``
    
  5. nicoburns commented on Sep 1, 2025

    @nicoburns
    Member

    Hmm... I guess it's the classname escaping then

  6. nicoburns commented on Sep 1, 2025

    @nicoburns
    Member

    Actually, I am not seeing the same as you.

    This works for me:

    .hover\:bg-amber-500 {
      &:hover {
        background-color: red;
      }
    }

    And this does not:

     .bg-amber-500 {
        &:hover {
          @media (hover: hover) {
            background-color: red;
          }
        }
      }
  7. added theissue type on Sep 1, 2025
  8. liaoliao666 commented on Sep 1, 2025

    @liaoliao666
    Author

    After I tried it again, you were right.

  9. UMCEKO commented on Jun 12, 2026

    @UMCEKO
    Contributor

    Adding a data point on impact: Tailwind v4 wraps every hover: variant in @media (hover: hover), so without the device claiming hover capability all hover styling in a Tailwind app is dropped (60+ rules in the app where we hit this) — not just explicit media queries. This makes #252 the single highest-impact styling gap for Tailwind-based Dioxus Native apps.

  10. nicoburns commented on Jul 3, 2026

    @nicoburns
    Member

    This should be fixed on main by today's upgrade to Stylo v0.19

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions