From 3a70bc6f13d3e6cabeb871d82dedd29fe40f65a6 Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Fri, 19 Jun 2026 09:53:06 +0800 Subject: [PATCH] fix(editor): exclude Alt-modified keys from web tool switch Codex review of the tool-switch wiring flagged that the keydown is_mod gate covers Cmd/Ctrl but not Alt, so an Alt+letter could trip the bare-letter tool router. Gate the tool shortcut on !alt_key; a resulting printable char still types via apply_text. --- crates/op-host-web/src/canvaskit.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/op-host-web/src/canvaskit.rs b/crates/op-host-web/src/canvaskit.rs index e8add1a2f..1388e2cf0 100644 --- a/crates/op-host-web/src/canvaskit.rs +++ b/crates/op-host-web/src/canvaskit.rs @@ -1147,7 +1147,11 @@ pub async fn mount_ck(canvas_id: String) -> Result<(), JsValue> { // (and any keystroke while a field is focused) types via // apply_text. if !is_mod { - if b.host.apply_tool_shortcut(key.as_str()) { + // Alt-modified keys never switch tools — Alt is a chord + // modifier (and on macOS yields special glyphs like ®/π), + // so an Alt+letter must not trip the bare-letter router. + // A resulting printable char still types via apply_text. + if !evt.alt_key() && b.host.apply_tool_shortcut(key.as_str()) { consumed = true; } else { let mut chars = key.chars();