Skip to content

Commit

Permalink
Merge pull request #158 from oddbird/allow-esc-to-be-defaultpreventable
Browse files Browse the repository at this point in the history
allow esc to be defaultpreventable
  • Loading branch information
jgerigmeyer authored Nov 30, 2023
2 parents 11eedfb + 74d2bda commit 4aeb532
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 4aeb532

Please sign in to comment.