mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36: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) {
|
||||
if (level > 1) return;
|
||||
e.preventDefault();
|
||||
open = true;
|
||||
x = e.x;
|
||||
y = e.y;
|
||||
|
@ -48,7 +49,7 @@
|
|||
</script>
|
||||
|
||||
<svelte:window
|
||||
on:contextmenu|preventDefault="{onContextMenu}"
|
||||
on:contextmenu="{onContextMenu}"
|
||||
on:click="{(e) => {
|
||||
if (!open) return;
|
||||
if (e.target.contains(ref)) close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue