Skip to content

Commit ec083e9

Browse files
committed
Fix outside press dismissal of hotspot tooltips
floating-ui appears to use native event handlers for detecting mousedown on the document, but React event callbacks for intercepting mousedown inside the floating element in the capture phase. Looks like capture phase for React events happens after native events in React 16. React 17 changes the event system here. This causes the first click on a link tooltip of the hotspot tooltip link button to close the tooltip before the link can be clicked in the editor. In the published editor it disables outside press dismissal once after a click inside the floating element. Disable capture for outside press to work around these issue.
1 parent 93c89cc commit ec083e9

File tree

1 file changed

+4
-1
lines changed
  • entry_types/scrolled/package/src/contentElements/hotspots

1 file changed

+4
-1
lines changed

entry_types/scrolled/package/src/contentElements/hotspots/Tooltip.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ export function Tooltip({
110110

111111
const dismiss = useDismiss(context, {
112112
outsidePressEvent: 'mousedown',
113-
outsidePress: event => !insidePagerButton(event.target)
113+
outsidePress: event => !insidePagerButton(event.target),
114+
capture: {
115+
outsidePress: false
116+
}
114117
});
115118

116119
const {getReferenceProps, getFloatingProps} = useInteractions([

0 commit comments

Comments
 (0)