Nested tooltips don't function as intended
See original GitHub issueWhat package has an issue
Describe the bug
Nested tooltips seem to inherit each-others properties leading to buggy behaviors or not showing at all.
See the linked demo where we attempt to nest a clickable Tooltip inside of a hoverable Tooltip, and instead neither fires.
What version of @mantine/hooks page do you have in package.json?
5.2.0
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/optimistic-meadow-95x4i9
Do you know how to fix the issue
No
Are you willing to participate in fixing this issue and create a pull request with the fix
Yes
Possible fix
Unknown. It works with TippyJS, however they manage this.
We had a custom wrapper to also help with this, but that doesn’t help in this case either unfortunately:
function mergeRefs(refs) {
return value => {
refs.forEach(ref => {
if (typeof ref === 'function') {
ref(value);
} else if (ref != null) {
ref.current = value;
}
});
};
}
const TooltipWrap = forwardRef(({ label, tooltipOpts = {}, children }, ref) => {
const mergedRefs = mergeRefs([children.ref, ref]);
return label ? (
<Tooltip
{...{
label,
// NOTE: Doesn't work even if we use ...props here
}}
{...tooltipOpts}
>
{React.cloneElement(children, { ref: mergedRefs })}
</Tooltip>
) : (
React.cloneElement(children, { ref: mergedRefs })
);
});
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Why is material-ui's tooltip not displaying when nested in a ...
When using the approach in my code below, the tooltips will not be displayed as expected with the proper handler functions:
Read more >nested tooltip with interactive: true · Issue #627 - GitHub
One small issue, say both tooltips are interactive, for example inner one contains long text, if you have to copy or to read...
Read more >Tippy Tooltips [Official Support] - Add-ons - Anki Forums
This is the official support thread for my add-on Tippy Tooltips. If you encounter any issues, please post them here, as I will...
Read more >Tooltips - Material Design
Tooltips display informative text when users hover over, focus on, or tap an element.
Read more >Tableau Tip: Tooltip Viz - The Data School
If you're not sure what this whole tooltip viz is, I'll use my submission for ... be able to hover on top of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Never mind my previous comment - there is a simpler solution which involves merging the incoming events (from the parent tooltip) with the current tooltip. I did a quick test and it appears to work. I’ll see if I can’t put together a PR.
Yes, I will try to resolve this, not sure if it is possible yet