mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.79k stars 1.9k forks source link

Tooltip does not work with Switch component #6850

Closed Cwhite534 closed 1 month ago

Cwhite534 commented 1 month ago

Dependencies check up

What version of @mantine/* packages do you have in package.json?

7.12.2

What package has an issue?

@mantine/core

What framework do you use?

Vite

In which browsers you can reproduce the issue?

All

Describe the bug

When wrapping a Switch component with a Tooltip component, the tooltip is not displayed when hovered with the mouse.

In this example no tooltip is displayed on mouse hover

<Tooltip label="This doesn't show the tooltip">
  <Switch
    checked={enabled}
    onChange={(e) => setEnabled(e.currentTarget.checked)}
    label="Enable a thing"
  />
</Tooltip>

In this example the tooltip renders as expected

<Tooltip label="This does show the tooltip">
  <Text>A text section</Text>
</Tooltip>

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-forked-mr8kvy?file=%2Fsrc%2FApp.tsx%3A1%2C1-26%2C1

Possible fix

No response

Self-service

Kenzo-Wada commented 1 month ago

here you go!

https://mantine.dev/core/switch/#with-tooltip