Skip to content

Commit

Permalink
allow esc to be defaultpreventable
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Nov 30, 2023
1 parent 7106a79 commit 74d2bda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand Down

0 comments on commit 74d2bda

Please sign in to comment.