Skip to content

[REMOTE-1809] fix: allow browser shortcuts in wasm sessions#11778

Merged
captainsafia merged 1 commit into
masterfrom
oz-agent/wasm-browser-shortcuts
Jun 3, 2026
Merged

[REMOTE-1809] fix: allow browser shortcuts in wasm sessions#11778
captainsafia merged 1 commit into
masterfrom
oz-agent/wasm-browser-shortcuts

Conversation

@captainsafia
Copy link
Copy Markdown
Contributor

@captainsafia captainsafia commented May 27, 2026

Summary

  • Let WASM/browser sessions pass browser-reserved keyboard shortcuts through instead of always calling preventDefault on canvas key events.
  • Use a platform-aware browser primary modifier (Cmd on macOS, Ctrl elsewhere) for common browser chrome shortcuts like tab navigation, reload, address bar focus, browser zoom, new/close/reopen tab/window shortcuts, plus F5 and Alt+Left/Right history navigation.
  • Keep existing Warp-owned keyboard handling and the existing paste passthrough behavior intact.

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 gui

Screenshot/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.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 27, 2026
@captainsafia captainsafia marked this pull request as ready for review May 28, 2026 23:14
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 28, 2026

@captainsafia

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = [
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bnavetta bnavetta changed the title fix: allow browser shortcuts in wasm sessions [REMOTE-1809] fix: allow browser shortcuts in wasm sessions Jun 1, 2026
@captainsafia captainsafia merged commit 808a54d into master Jun 3, 2026
56 checks passed
@captainsafia captainsafia deleted the oz-agent/wasm-browser-shortcuts branch June 3, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants