From 6eb9b823cdace19b5d389f8fdf8fb09db21874b0 Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Wed, 22 Nov 2023 09:28:19 +0100 Subject: [PATCH] fix: make argument `element` of helper function `onEscape` optional --- src/lib/actions/onEscape.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/actions/onEscape.ts b/src/lib/actions/onEscape.ts index db8f2841..de863a6b 100644 --- a/src/lib/actions/onEscape.ts +++ b/src/lib/actions/onEscape.ts @@ -21,7 +21,7 @@ function handleKeyDown(event: KeyboardEvent) { * This is useful for example when opening a model on top of another modal: * you only want the top modal to close on Escape, and not the second modal. */ -export function onEscape(element: Element, callback: Callback) { +export function onEscape(element: Element | null, callback: Callback) { if (isEmpty(callbacks)) { window.addEventListener('keydown', handleKeyDown) }