-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tooltip] Tooltip as a child takes onClick
props from parent by default
#36087
Comments
onClick
props from parent by default
Can you share a CodeSandbox that shows how you use it? Normally, the interactive element should be wrapped with Tooltip, not the other way around? |
Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information. |
Hello @siriwatknp , sorry for not responding, this task fell behind. I prepared simple codesandbox example. Try to copy text from tooltip, it changes background color of parent component. Is this usage wrong? |
Hi @siriwatknp , anything new on this issue? It is still open. Thanks |
Even I faced the same issue. <TableCell onClick={handleClick}>
<Tooltip
title='My Awesome Title'
PopperProps={{
onClick(e) {
e.stopPropagation();
}
}}
>
<span>My Awesome Title</span>
</Tooltip>
</TableCell> After attaching a click event handler to |
+1. I just ran into this today; I have a card component that has a descendant tooltip and I noticed that clicking on this tooltip (in order to select its text) was triggering the card's onClick! Easy enough to workaround, just wanted to bump this for visibility. |
What's the problem? 🤔
When using MUI Tooltip as a child of an interactive element, it takes onClick props from parent by default. Is this a bug, or intended behaviour? There is a workaround where you can set
e.stopPropagation
tocomponentProps
, but it would be better if it takes it as default prop.What are the requirements? ❓
No response
What are our options? 💡
No response
Proposed solution 🟢
No response
Resources and benchmarks 🔗
No response
The text was updated successfully, but these errors were encountered: