mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
fix(web): escape shortcut (#3753)
* fix: escape shortcut * feat: more escape scenarios * feat: more escape shortcuts --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import type { ActionReturn } from 'svelte/action';
|
||||
|
||||
interface Attributes {
|
||||
'on:outclick'?: (e: CustomEvent) => void;
|
||||
'on:escape'?: (e: CustomEvent) => void;
|
||||
}
|
||||
|
||||
export function clickOutside(node: HTMLElement): ActionReturn<void, Attributes> {
|
||||
@@ -14,7 +15,7 @@ export function clickOutside(node: HTMLElement): ActionReturn<void, Attributes>
|
||||
|
||||
const handleKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
node.dispatchEvent(new CustomEvent('outclick'));
|
||||
node.dispatchEvent(new CustomEvent('escape'));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user