Skip to content

Commit

Permalink
feat: pass options to dismiss hook
Browse files Browse the repository at this point in the history
  • Loading branch information
amje committed Dec 4, 2024
1 parent 213e006 commit 8e47cae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/lab/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export function Popover({
enableSafePolygon,
className,
contentClassName,
disableEscapeKeyDown,
disableOutsideClick,
...restProps
}: PopoverProps) {
const child = React.Children.only(children);
Expand Down Expand Up @@ -88,7 +90,10 @@ export function Popover({
handleClose: enableSafePolygon ? safePolygon() : undefined,
});
const click = useClick(context, {enabled: !disabled && trigger !== 'hover'});
const dismiss = useDismiss(context);
const dismiss = useDismiss(context, {
escapeKey: !disableEscapeKeyDown,
outsidePress: !disableOutsideClick,
});
const role = useRole(context, {role: 'dialog'});

const {getReferenceProps, getFloatingProps} = useInteractions([hover, click, dismiss, role]);
Expand Down

0 comments on commit 8e47cae

Please sign in to comment.