Skip to content

Commit

Permalink
fix: fixed popover overflowing edge of browser (#26464)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamleithp authored Nov 27, 2024
1 parent 4fc35bd commit 48107f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/lib/lemon-ui/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ export const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(function P
strategy: 'fixed',
middleware: [
...(fallbackPlacements ? [flip({ fallbackPlacements, fallbackStrategy: 'initialPlacement' })] : []),
shift(),
shift({ padding: 8, boundary: document.body }), // Add padding and use document.body as boundary
size({
padding: 4,
apply({ availableWidth, availableHeight, rects, elements: { floating } }) {
floating.style.maxHeight = `${availableHeight}px`
floating.style.maxWidth = `${availableWidth}px`
floating.style.maxWidth = `${Math.min(availableWidth, window.innerWidth - 16)}px` // Ensure popover doesn't extend past window edge
floating.style.width = 'initial'
if (matchWidth) {
floating.style.minWidth = `${rects.reference.width}px`
Expand Down

0 comments on commit 48107f6

Please sign in to comment.