refactor(web): remove events from clickOutside action (#9943)

This commit is contained in:
Michel Heusschen 2024-06-02 14:20:11 +02:00 committed by GitHub
parent 5af67d159f
commit d1135db8cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 18 additions and 61 deletions

View file

@ -8,6 +8,7 @@
export let y = 0;
export let menuElement: HTMLDivElement | undefined = undefined;
export let onClose: (() => void) | undefined = undefined;
let left: number;
let top: number;
@ -36,9 +37,7 @@
style:top="{top}px"
style:left="{left}px"
role="menu"
use:clickOutside
on:outclick
on:escape
use:clickOutside={{ onOutclick: onClose, onEscape: onClose }}
>
<div class="flex flex-col rounded-lg">
<slot />

View file

@ -49,14 +49,7 @@
on:contextmenu|preventDefault={reopenContextMenu}
role="presentation"
>
<ContextMenu
{x}
{y}
{direction}
on:outclick={closeContextMenu}
on:escape={closeContextMenu}
bind:menuElement={contextMenuElement}
>
<ContextMenu {x} {y} {direction} onClose={closeContextMenu} bind:menuElement={contextMenuElement}>
<slot />
</ContextMenu>
</section>

View file

@ -114,9 +114,10 @@
{/if}
<div
use:clickOutside
on:outclick={() => (shouldShowAccountInfoPanel = false)}
on:escape={() => (shouldShowAccountInfoPanel = false)}
use:clickOutside={{
onOutclick: () => (shouldShowAccountInfoPanel = false),
onEscape: () => (shouldShowAccountInfoPanel = false),
}}
>
<button
type="button"