Skip to main content

Module AppMenu

Module AppMenu 

Source
Expand description

macOS app menu override - removes Undo/Redo so Cmd+Z reaches Monaco. macOS application menu - Edit submenu without Undo/Redo.

Tauri’s Builder::default() on macOS installs the standard AppKit menu bar, which includes Edit → Undo (Cmd+Z) and Edit → Redo (Cmd+Shift+Z). These native items intercept Cmd+Z at the macOS responder-chain level before the WKWebView’s JavaScript keydown handler fires, so VS Code’s Monaco editor never sees the event - the native WKWebView text-buffer undo runs instead, and nothing happens visually (Monaco’s undo stack is untouched). Ctrl+Z reaches the JS layer because no native menu binds it.

Removing Undo/Redo from the native Edit menu lets Cmd+Z pass through to the WKWebView’s keydown handler where VS Code registers meta+z → undo. Cut/Copy/Paste/SelectAll stay as predefined items so native text fields (e.g., address bar inputs) keep working correctly.

On Windows / Linux, no menu override is applied - those platforms do not have the same WKWebView responder-chain interception.

Functions§

SetAppMenu
Install a custom app menu on App, removing Undo/Redo from the Edit submenu so Cmd+Z reaches VS Code’s Monaco keybinding handler.