fix(context-menu): prevent on:contextmenu default behavior only when opening menu (#1911)

Fixes #1909
This commit is contained in:
metonym 2024-02-07 14:37:44 -08:00 committed by GitHub
commit 4ad522c197
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,6 +59,7 @@
/** @type {(e: MouseEvent) => void} */
function openMenu(e) {
e.preventDefault();
const { height, width } = ref.getBoundingClientRect();
if (open || x === 0) {
@ -138,7 +139,7 @@
</script>
<svelte:window
on:contextmenu|preventDefault="{(e) => {
on:contextmenu="{(e) => {
if (target != null) return;
if (level > 1) return;
if (!ref) return;