tauri
tauri copied to clipboard
[v2] context menu disappears on button release
Describe the bug
When I popup a context menu using JS API @tauri-apps/api/menu, the menu shows normally, but is closed as soon as the right mouse button is released.
This makes it quite unusable.
Reproduction
Svelte minimal example:
<script lang="ts">
import { Menu, MenuItem } from '@tauri-apps/api/menu';
async function contextMenu() {
const menu = await Menu.new();
menu.append(
await MenuItem.new({
text: 'Open',
action: async () => {}
})
);
await menu.popup();
}
</script>
<div>
<p on:contextmenu|preventDefault={contextMenu}>test</p>
</div>
Expected behavior
The context menu should behave just like with any other toolkit.
Full tauri info output
[✔] Environment
- OS: Ubuntu 23.10.0 X64
✔ webkit2gtk-4.1: 2.44.0
✔ rsvg2: 2.54.7
✔ rustc: 1.75.0 (82e1608df 2023-12-21)
✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
- node: 21.5.0
- pnpm: 8.15.5
- npm: 10.2.4
[-] Packages
- tauri [RUST]: 2.0.0-beta.17 (no manifest)
- tauri-build [RUST]: 2.0.0-beta.13 (no manifest)
- wry [RUST]: 0.39.3 (no manifest)
- tao [RUST]: 0.27.1 (no manifest)
- tauri-cli [RUST]: 2.0.0-beta.15
- @tauri-apps/api [NPM]: 2.0.0-beta.11
- @tauri-apps/cli [NPM]: 2.0.0-beta.15
[-] App
- build-type: build
- CSP: unset
- frontendDist: ../build
- devUrl: http://localhost:5173/
- framework: Svelte
- bundler: Vite
Stack trace
No response
Additional context
No response