Fix escape handling

This commit is contained in:
Jamie Kyle 2023-03-23 15:35:15 -07:00 committed by GitHub
parent e819984239
commit 9fe7bb41ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,14 +17,10 @@ export function useEscapeHandling(handleEscape?: () => unknown): void {
event.stopPropagation(); event.stopPropagation();
} }
}; };
document.addEventListener('keydown', handler, { document.addEventListener('keydown', handler);
capture: true,
});
return () => { return () => {
document.removeEventListener('keydown', handler, { document.removeEventListener('keydown', handler);
capture: true,
});
}; };
}, [handleEscape]); }, [handleEscape]);
} }