Skip to content

Commit 2200f86

Browse files
authored
fix(dialog): ESC freezes browser
1 parent 3e43f7c commit 2200f86

File tree

1 file changed

+5
-0
lines changed
  • packages/kit-headless/src/components/modal

1 file changed

+5
-0
lines changed

packages/kit-headless/src/components/modal/modal.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ export const Modal = component$((props: ModalProps) => {
8888
{...props}
8989
role={props.alert === true ? 'alertdialog' : 'dialog'}
9090
ref={modalRefSig}
91+
onKeyDown$={(event) => {
92+
if (event.key === 'Escape') {
93+
showSig.value = false;
94+
}
95+
}}
9196
onClick$={(event) => closeOnBackdropClick$(event)}
9297
>
9398
<Slot />

0 commit comments

Comments
 (0)