[REMOTE-1809] fix: allow browser shortcuts in wasm sessions#11778
Conversation
Co-Authored-By: Oz <oz-agent@warp.dev>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR updates the WASM canvas keyboard preventDefault listener so common browser chrome shortcuts can use the browser default behavior while preserving the existing paste passthrough. The shortcut set is platform-aware for the browser primary modifier and covers reload, tab/window, address bar, zoom, and history navigation cases described in the PR.
Concerns
- No blocking correctness, security, or spec-alignment concerns found in the reviewed diff. No approved spec context was available for this PR.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| // These are standard browser chrome shortcuts that should keep working in WASM sessions. | ||
| // This allowlist uses the browser's primary shortcut modifier for the current OS | ||
| // (Cmd on macOS, Ctrl elsewhere), so the behavior is not macOS-specific. | ||
| let browser_primary_shortcut_keys = [ |
There was a problem hiding this comment.
I'm not swallowing everything at the moment. For example, Cmd + P will still open our Command Palette and not the browser's print option (that makes sense to me) but we can tweak the set here.
| // These are standard browser chrome shortcuts that should keep working in WASM sessions. | ||
| // This allowlist uses the browser's primary shortcut modifier for the current OS | ||
| // (Cmd on macOS, Ctrl elsewhere), so the behavior is not macOS-specific. | ||
| let browser_primary_shortcut_keys = [ |
There was a problem hiding this comment.
not a blocking comment, but is this pattern how we detect shifted key combos elsewhere in warp?
let browser_shifted_primary_shortcut_keys = [
"-", "=", "+", "[", "]", "{", "}", "n", "r", "t", "tab", "w", "pageup", "pagedown",
];
if event.shift_key() {
There was a problem hiding this comment.
Warp has a custom Keystroke struct that it uses for modified keypresses but I believe the key distinguisher here is that we are capturing the browser's KeypressEvent decided whether to pass it to Warp or allow the browser to handle it.
Summary
Why
Browser sessions were hijacking shortcuts before Warp keybinding settings could matter. Disabling a Warp shortcut could stop the Warp action, but the WASM preventDefault listener still blocked the browser default.
Validation
ASSET_TARGET_DIR=/workspace/warp/target/wasm32-unknown-unknown/dev-wasm/bundle/assets cargo check --target wasm32-unknown-unknown --profile dev-wasm --bin dev --features guiScreenshot/Video
https://www.loom.com/share/e7eff81b0ece4393b63059d6ff68610b
Conversation: https://staging.warp.dev/conversation/631c6c08-fd5f-4d56-8851-f7ecf90e85bb
Run: https://oz.staging.warp.dev/runs/019e6b3a-b4bb-7cc4-8bcb-0ede5f4a270d
This PR was generated with Oz.