Skip to content

[bug]: <Item> generates a [a]:hover:bg-accent/50 class, which doesn't work #8382

@spikebrehm

Description

@spikebrehm

Describe the bug

For Items used as links, e.g.:

<Item variant="outline" role="listitem" asChild>
  <Link href={href}>
    <ItemContent>
      {/* ... */}
    </ItemContent>
  </Link>
</Item>

Shadcn uses the [a]:hover:bg-accent/50 class to target the anchor tag. This doesn't work, but [&:is(a):hover]:bg-accent/50 does.

Tailwind version:

    "tailwindcss": "^3.4.1"

Affected component/components

Item

How to reproduce

<Item variant="outline" role="listitem" asChild>
  <Link href={href}>
    <ItemContent>
      {/* ... */}
    </ItemContent>
  </Link>
</Item>

Codesandbox/StackBlitz link

No response

Logs

System Info

macOS, Chrome

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions