macOS WebView does not respond to keyboard events until clicked
Describe the bug
Launching a Tauri app on macOS does not automatically "focus" the webview, so keyboard events are ignored until I explicitly click on the window. I'm using a Tauri project to demonstrate the issue, but the actual code at fault lives in tao.
To Reproduce
Steps to reproduce the behavior:
- Clone https://github.com/kofigumbs/tauri-macos-first-responder
cd src-tauri && cargo run(orcargo tauri dev)- Press any keyboard key to try and interact with the app
Expected behavior
The app should be immediately responsive to keyboard events without requiring the user to click. I worked around this issue by explicitly calling makeFirstResponder_. You can run the above with --features make-first-responder to verify.
Additional context
It looks like tao used to use makeFirstResponder_, but switched to initialResponder in https://github.com/tauri-apps/tao/commit/45aacd840752bc1af07677da44af4911dbd701c8. Apple's API docs suggest that that is the right approach, so I'm not sure why it doesn't work. If the path forward is as simple as reverting https://github.com/tauri-apps/tao/commit/45aacd840752bc1af07677da44af4911dbd701c8, I'd be happy to do the leg work to submit the PR.