From 2e10b0678a171593656ee3d497889e1a505c914f Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Wed, 26 Apr 2023 11:55:59 +0200 Subject: [PATCH] Fix escape on popover --- site/source/design-system/popover/Popover.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/site/source/design-system/popover/Popover.tsx b/site/source/design-system/popover/Popover.tsx index e8d55c05c..27b55154f 100644 --- a/site/source/design-system/popover/Popover.tsx +++ b/site/source/design-system/popover/Popover.tsx @@ -112,12 +112,22 @@ export default function Popover( focusable element before and after the iframe for the FocusTrap to work. The CloseButton counts as the before element, so you just need a focusable element after the iframe. */} - + { + if (props.isDismissable && e.key === 'Escape') { + props.onClose?.() + } + }} ref={ref} aria-label={title || t('Boite de dialogue')} title="modal"