Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/@react-aria/overlays/src/usePopover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export interface AriaPopoverProps extends Omit<AriaPositionProps, 'isOpen' | 'on
* By default, onClose will always be called on interaction outside the popover ref.
*/
shouldCloseOnInteractOutside?: (element: Element) => boolean
/**
* Nothing will be hidden above this element when a popup is modal.
*/
rootHiddenOutsideElement?: Element
}

export interface PopoverAria {
Expand Down Expand Up @@ -89,6 +93,7 @@ export function usePopover(props: AriaPopoverProps, state: OverlayTriggerState):
isNonModal,
isKeyboardDismissDisabled,
shouldCloseOnInteractOutside,
rootHiddenOutsideElement,
...otherProps
} = props;

Expand Down Expand Up @@ -123,7 +128,7 @@ export function usePopover(props: AriaPopoverProps, state: OverlayTriggerState):
if (isNonModal) {
return keepVisible(groupRef?.current ?? popoverRef.current);
} else {
return ariaHideOutside([groupRef?.current ?? popoverRef.current], {shouldUseInert: true});
return ariaHideOutside([groupRef?.current ?? popoverRef.current], {shouldUseInert: true, root: rootHiddenOutsideElement});
}
}
}, [isNonModal, state.isOpen, popoverRef, groupRef]);
Expand Down