Skip to content

[bug]: SidebarMenuButton: render prop ignored when tooltip is present (Base UI) #9277

@davidjr82

Description

@davidjr82

Describe the bug

The issue is in the SidebarMenuButton component, in this line:

render: !tooltip ? render : TooltipTrigger,

When there's a tooltip, it replaces the render prop with TooltipTrigger, losing the Link entirely.

Workaround: Change the render logic to always respect the render prop, then wrap with TooltipTrigger using composition:

const comp = useRender({
  // ...
  render, // Always use the render prop
  // ...
})

return (
  <Tooltip>
    <TooltipTrigger render={comp} />
    <TooltipContent ... />
  </Tooltip>
)

This preserves the composition chain: TooltipTrigger → Link → button content.

Affected component/components

Sidebar (SidebarMenuButton)

How to reproduce

  1. Add a SidebarMenuButton with both render and tooltip props:
<SidebarMenuButton
  tooltip={{ children: "Dashboard" }}
  render={<Link href="/dashboard" />}
>
  <LayoutGrid />
  <span>Dashboard</span>
</SidebarMenuButton>
  1. Click on the sidebar menu item
  2. Expected: Navigation to /dashboard
  3. Actual: Nothing happens - the button is not clickable as a link

Codesandbox/StackBlitz link

No response

Logs

System Info

- shadcn/ui: latest (with Base UI style)
- @base-ui/react: 1.0.0
- React: 19
- Browser: Brave
- OS: macOS

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