Skip to content
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

Clicks on tooltips are propagated to parent components #4480

Open
snow893 opened this issue May 4, 2023 · 3 comments · Fixed by #4479
Open

Clicks on tooltips are propagated to parent components #4480

snow893 opened this issue May 4, 2023 · 3 comments · Fixed by #4479

Comments

@snow893
Copy link
Contributor

snow893 commented May 4, 2023

🐛 Bug Report

Tooltip click propagates to parent div. It's possible to click it by mousing over where the arrow is and onto the tooltip.

🤔 Expected Behavior

Clicking tooltip shouldn't propagate to parent divs.

😯 Current Behavior

When there's a tooltip trigger within a parent div, clicking on the tooltip propagates the click event to the parent div. This effectively makes it click whatever's underneath it.

💁 Possible Solution

#4479

🔦 Context

Currently in our app we have to do the following:
const handleOverlayClick = (e: React.MouseEvent) => {
resetLiveEdit(selectedField?.id);
if ((e.target as Element).className?.match(/^spectrum-Tooltip/)) {
return;
}

This is clearly not ideal.

💻 Code Sample

Left tooltip as always open, but it's easily reproducible with normal hover open behavior.
https://codesandbox.io/s/tooltip-j54xrm?file=/src/App.js

🌍 Your Environment

Software Version(s)
react-spectrum
Browser
Operating System

🧢 Your Company/Team

🕷 Tracking Issue (optional)

@snowystinger
Copy link
Member

Reopening because we'll solve this a different way
reverting - #4535

After a team discussion, we've decided to address this in all of our portalled components using something like facebook/react#11387 (comment)
and provide guidance in our FAQ on how to ignore events that come through a portal.

@mryechkin
Copy link

Hi @snowystinger, just wondering if the team has an idea of when this fix will be worked on?

We're currently looking at utilizing the Tooltip from RAC, but running into this issue as well. The particular use case is an element with a tooltip that's within a modal - clicking on the tooltip container causes the entire modal to close.

Thanks

@snowystinger
Copy link
Member

Unfortunately, it doesn't fit in the current priorities for the team. If you need it soon, the fastest way to get it discussed/reviewed is to submit a PR. This has the benefit that you can use tools like patch-package in the meantime so that it will eventually match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants