Skip to content

Commit

Permalink
fix: make argument element of helper function onEscape optional
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Nov 22, 2023
1 parent f6b2485 commit 6eb9b82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/actions/onEscape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 6eb9b82

Please sign in to comment.