From 8e47caec74d7b6b4b02f44c33b9fa47f835fee4c Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Fri, 29 Nov 2024 21:01:52 +0300 Subject: [PATCH] feat: pass options to dismiss hook --- src/components/lab/Popover/Popover.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/lab/Popover/Popover.tsx b/src/components/lab/Popover/Popover.tsx index 6577a8c3c8..effed23042 100644 --- a/src/components/lab/Popover/Popover.tsx +++ b/src/components/lab/Popover/Popover.tsx @@ -58,6 +58,8 @@ export function Popover({ enableSafePolygon, className, contentClassName, + disableEscapeKeyDown, + disableOutsideClick, ...restProps }: PopoverProps) { const child = React.Children.only(children); @@ -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]);