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鈥檒l 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 · 1 comment 路 Fixed by #4479
Open

Clicks on tooltips are propagated to parent components #4480

snow893 opened this issue May 4, 2023 · 1 comment 路 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.

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.

2 participants