Repository navigation
fix(keys): yield to menus only where their shortcuts apply - #462
Conversation
0da7355 to
a89e7c2
Compare
a89e7c2 to
7f58b5a
Compare
Add a native Windows regression that presses Control+R through the window's shortcut path with a MenuNotEditing item and a yielding binding, outside any field, in a field and in a WebView2 page, and unwrap the comments the fix added.
7f58b5a to
ddb8966
Compare
|
Reviewed. Read the full diff against main and the Acceptance of #447, and rebased the branch onto current main (no conflicts, CHANGELOG.md untouched, no hard-wrapped lines or attribution). Code review: Fail-without-fix checks:
Builds and tests (after each rebase): Devices:
Minor, not blocking: since main now keeps every GTK test window on one thread, the reason given for running |
A
MenuNotEditingitem with Command/Control+R removed a yielding reload binding even while a text field had focus and the menu declined the shortcut, so the key did nothing. Keep yielding bindings active while the menu leaves their key to an input or web view, and refresh the mounted keymap as focus moves, blurs, or its view is removed.Track desktop WebView focus through NSWindow first-responder observation (including embedded views moving between host windows), a GTK subtree focus controller, and WebView2 focus events. Route these reports through core's shared focus handling, so a focused page also counts for confined bindings,
HoldsFocusand focus-within. Update the keyboard behavior documentation in English and Chinese.Closes #447.
Verification:
go build ./..., cross vets ofcorefor windows/amd64, linux/amd64, android/arm64 and js/wasm, vets of the Windows, Linux and macOS backends, andgo tool nsgo check -target allpassed.go tool nsgo test ./coreandgo tool nsgo test -run 'Layer|Skills|Doc' .passed.TestMenuYieldFollowsNativeFocuspresses Control+R through the window's shortcut path outside any field (the menu item runs), in a field (the binding runs), after blur (the item again), in a focused WebView2 page (the binding) and after the page gives the focus back (the item). It fails without the WebView2 focus reporting. The existing Windows menu, web and key tests still pass.TestMenuYieldFollowsNativeTextFocusandTestMenuYieldFollowsNativeWebFocuspass; the web test fails without the GTK focus controller. On that VM WebKit's bubblewrap sandbox cannot start (bwrap: setting up uid map: Permission denied), so the web test ran withWEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1.MenuNotEditingCommand+R item and a yielding binding, Command+R outside any field ran the item, and with a WKWebView page or the text field focused ran the binding. Built without this change, the same presses in the page and the field did nothing.TestWebFocusFollowsTheHostWindowand the macOS menu tests pass.Known limit, not changed here: on Windows a WebView2 page with the keyboard focus keeps every key, so neither app bindings nor menu shortcuts see Control+R there (the page reloads instead); the keymap state above is still correct for when such keys are routed.