mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(web): context menu overlap + outclick types (#2506)
This commit is contained in:
parent
96fb68135e
commit
85c6cf4309
7 changed files with 36 additions and 52 deletions
|
|
@ -1,5 +1,11 @@
|
|||
export function clickOutside(node: Node) {
|
||||
const handleClick = (event: Event) => {
|
||||
import type { ActionReturn } from 'svelte/action';
|
||||
|
||||
interface Attributes {
|
||||
'on:outclick'?: (e: CustomEvent) => void;
|
||||
}
|
||||
|
||||
export function clickOutside(node: HTMLElement): ActionReturn<void, Attributes> {
|
||||
const handleClick = (event: MouseEvent) => {
|
||||
const targetNode = event.target as Node | null;
|
||||
if (!node.contains(targetNode)) {
|
||||
node.dispatchEvent(new CustomEvent('outclick'));
|
||||
|
|
@ -7,7 +13,7 @@ export function clickOutside(node: Node) {
|
|||
};
|
||||
|
||||
const handleKey = (event: KeyboardEvent) => {
|
||||
if (event.key == 'Escape') {
|
||||
if (event.key === 'Escape') {
|
||||
node.dispatchEvent(new CustomEvent('outclick'));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue