mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
fix(web): clicking away closes context menu (#16989)
* fix(web): clicking away closes context menu * fix: use pointerdown event instead * Revert "fix: use pointerdown event instead" This reverts commit 0d2cf4719458a1d3804c43c3877297aaf41bc107.
This commit is contained in:
parent
bcd9248b43
commit
3c87341902
@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { clickOutside } from '$lib/actions/click-outside';
|
||||
import { contextMenuNavigation } from '$lib/actions/context-menu-navigation';
|
||||
import { shortcuts } from '$lib/actions/shortcut';
|
||||
import CircleIconButton, {
|
||||
@ -105,6 +104,19 @@
|
||||
closeDropdown();
|
||||
};
|
||||
|
||||
const handleDocumentClick = (event: MouseEvent) => {
|
||||
if (!isOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = event.target as Node | null;
|
||||
if (buttonContainer?.contains(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
closeDropdown();
|
||||
};
|
||||
|
||||
const focusButton = () => {
|
||||
const button = buttonContainer?.querySelector(`#${buttonId}`) as HTMLButtonElement | null;
|
||||
button?.focus();
|
||||
@ -118,6 +130,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:window onresize={onResize} />
|
||||
<svelte:document onclick={handleDocumentClick} />
|
||||
|
||||
<div
|
||||
use:contextMenuNavigation={{
|
||||
@ -129,7 +142,6 @@
|
||||
selectedId: $selectedIdStore,
|
||||
selectionChanged: (id) => ($selectedIdStore = id),
|
||||
}}
|
||||
use:clickOutside={{ onOutclick: closeDropdown }}
|
||||
onresize={onResize}
|
||||
{...restProps}
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user