Clicks on tooltips are propagated to parent components
- Dominant language
- TypeScript
- Stars
- 15.9k
- Forks
- 1.6k
- Avg merge
- 3d 9m
- Merged PRs (30d)
- 59
Description
# 🐛 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
https://github.com/adobe/react-spectrum/pull/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)
Contributor guide
Assessment
This issue has not been assessed yet.