High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(web): Allow closing modals with Escape key (#2257)
bo0tzz5b241f0b64fa
diff --git a/web/src/lib/utils/click-outside.ts b/web/src/lib/utils/click-outside.tsindex dae9848626..e54ee8ef09 100644--- a/web/src/lib/utils/click-outside.ts+++ b/web/src/lib/utils/click-outside.ts@@ -6,11 +6,19 @@ export function clickOutside(node: Node) {}};+ const handleKey = (event: KeyboardEvent) => {+ if (event.key == 'Escape') {+ node.dispatchEvent(new CustomEvent('outclick'));+ }+ };+document.addEventListener('click', handleClick, true);+ document.addEventListener('keydown', handleKey, true);return {destroy() {document.removeEventListener('click', handleClick, true);+ document.removeEventListener('keydown', handleKey, true);}};}