Skip to content

fix(macos): forward unhandled keyDown events to WebView content#1711

Open
AprilNEA wants to merge 1 commit into
tauri-apps:devfrom
AprilNEA:fix/macos-keydown-forwarding
Open

fix(macos): forward unhandled keyDown events to WebView content#1711
AprilNEA wants to merge 1 commit into
tauri-apps:devfrom
AprilNEA:fix/macos-keydown-forwarding

Conversation

@AprilNEA
Copy link
Copy Markdown

@AprilNEA AprilNEA commented Apr 9, 2026

Summary

On macOS, WryWebViewParent::keyDown: unconditionally sends all key events to menu.performKeyEquivalent() without checking the return value or forwarding unhandled events. This causes bare key presses (numbers, symbols, arrow keys) to be silently swallowed — they never reach the WKWebView content, especially in iframe-based applications.

Changes

  • Only route key events to performKeyEquivalent when Command or Control modifiers are held
  • Check performKeyEquivalent return value — if the menu handled it, stop; otherwise fall through
  • For unhandled keys, call interpretKeyEvents (not super.keyDown) to avoid re-introducing the NSBeep sound fixed in PR fix(macos): do not trigger unsupported key feedback sound on keypress #742
  • Option (Alt) is intentionally excluded from the modifier check — Option+key is used for special character / dead-key input

Background

PR What happened
#742 Added interpretKeyEvents to suppress beep
#760 Added performKeyEquivalent for menu shortcuts
#798 Removed all keyDown overrides (clean slate)
#801 Re-added performKeyEquivalent without return value check — current buggy state

Known limitation

This does not fix Cmd+key JavaScript listeners in child webviews (the existing FIXME in wry_web_view.rs:47-50). That is a separate issue tracked in #1177.

Fixes #1175
Refs #1177, #801

@AprilNEA AprilNEA requested a review from a team as a code owner April 9, 2026 14:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

Package Changes Through bcd1493

No changes.

Add a change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

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.

Arrow keys doesn't work on MacOS

2 participants