mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
only preventDefault on root context menu
This commit is contained in:
parent
6b95fb6db0
commit
cfc99c53bf
1 changed files with 2 additions and 1 deletions
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
function onContextMenu(e) {
|
function onContextMenu(e) {
|
||||||
if (level > 1) return;
|
if (level > 1) return;
|
||||||
|
e.preventDefault();
|
||||||
open = true;
|
open = true;
|
||||||
x = e.x;
|
x = e.x;
|
||||||
y = e.y;
|
y = e.y;
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window
|
<svelte:window
|
||||||
on:contextmenu|preventDefault="{onContextMenu}"
|
on:contextmenu="{onContextMenu}"
|
||||||
on:click="{(e) => {
|
on:click="{(e) => {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
if (e.target.contains(ref)) close();
|
if (e.target.contains(ref)) close();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue