Skip to content

Commit

Permalink
Move to wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitgrelard committed Mar 1, 2024
1 parent 5bbbb04 commit 0bba9de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .yarn/versions/dc4b1017.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
releases:
"@radix-ui/react-context-menu": patch
"@radix-ui/react-dropdown-menu": patch
"@radix-ui/react-hover-card": patch
"@radix-ui/react-menu": patch
"@radix-ui/react-menubar": patch
"@radix-ui/react-popover": patch
"@radix-ui/react-popper": patch
"@radix-ui/react-select": patch
"@radix-ui/react-tooltip": patch

declined:
- primitives
13 changes: 8 additions & 5 deletions packages/react/popper/src/Popper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ const PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>
middlewareData.transformOrigin?.x,
middlewareData.transformOrigin?.y,
].join(' '),

// 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
...(middlewareData.hide?.referenceHidden && {
visibility: 'hidden',
pointerEvents: 'none',
}),
}}
// Floating UI interally calculates logical alignment based the `dir` attribute on
// the reference/floating node, we must add this attribute here to ensure
Expand All @@ -267,11 +275,6 @@ const PopperContent = React.forwardRef<PopperContentElement, PopperContentProps>
// if the PopperContent hasn't been placed yet (not all measurements done)
// 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 0bba9de

Please sign in to comment.