From 74d2bdace6f1508b1ea47c9391b74e9e980c2016 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 30 Nov 2023 17:24:04 +0000 Subject: [PATCH] allow esc to be defaultpreventable --- src/popover.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/popover.ts b/src/popover.ts index 98f5186..43e8a26 100644 --- a/src/popover.ts +++ b/src/popover.ts @@ -323,7 +323,11 @@ export function apply() { const onKeydown = (event: Event) => { const key = (event as KeyboardEvent).key; const target = event.target as Element; - if (target && (key === 'Escape' || key === 'Esc')) { + if ( + !event.defaultPrevented && + target && + (key === 'Escape' || key === 'Esc') + ) { hideAllPopoversUntil(target.ownerDocument, true, true); } };