Skip to content

Commit

Permalink
fix(context-menu): prevent on:contextmenu default behavior only whe…
Browse files Browse the repository at this point in the history
…n opening menu (#1911)

Fixes #1909
  • Loading branch information
metonym authored Feb 7, 2024
1 parent 6590457 commit 4ad522c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ContextMenu/ContextMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
/** @type {(e: MouseEvent) => void} */
function openMenu(e) {
e.preventDefault();
const { height, width } = ref.getBoundingClientRect();
if (open || x === 0) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4ad522c

Please sign in to comment.