Skip to content

Commit

Permalink
fix(Popper): disable pointer events when hidden
Browse files Browse the repository at this point in the history
This patch sets `pointer-events: none` when the `<PopperContent>` is
hidden so that the UI behaves as if it is not there at all. This ensures
that users can interact with elements beneath the `<PopperContent>`
uninterrupted.

Ref: #2743 (comment)

Fixes: e5ba0d9 ("fix(Popper): use `visibility` to hide instead of `opacity` (#2744)")
  • Loading branch information
nicholaschiang committed Feb 29, 2024
1 parent 8b1162c commit 5bbbb04
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react/popper/src/Popper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ const PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>
// we prevent animations so that users's animation don't kick in too early referring wrong sides
animation: !isPositioned ? 'none' : undefined,
// hide the content if using the hide middleware and should be hidden
// set visibility to hidden and disable pointer events so the UI behaves
// as if the PopperContent isn't there at all
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : undefined,
pointerEvents: middlewareData.hide?.referenceHidden ? 'none' : undefined,
}}
/>
</PopperContentProvider>
Expand Down

0 comments on commit 5bbbb04

Please sign in to comment.