Stop toolbar taps from resummoning the dismissed keyboard (#200) - #206
Merged
Conversation
Chain, established on device: dismissing the IME with Back leaves the Muya host FOCUSED; every toolbar control prevents pointer defaults so taps never move focus; and Android Chromium re-shows the keyboard for any page-consumed tap while an editable holds focus. Expand/collapse, the panel switcher, its menu options - every navigational tap brought the keyboard back. - One capture-phase pointerdown hook on the toolbar root: when the IME reads hidden, strip editor-owned focus before the tap completes - Chromium then has nothing to resummon the keyboard for. Edit commands restore focus themselves through the restore-range machinery, so their keyboard behavior is unchanged; with the keyboard up the guard stands down and typing workflows keep focus exactly as before. - The panel-menu selection re-apply now runs only while the editor owns focus: addRange() into an editable FOCUSES it on Chromium, which resummoned the keyboard right after the guard had avoided it (device- proven); the caret handle it hides only exists for a focused editable anyway. - IME visibility is estimated from adjustResize window geometry: height notably below the tallest seen for the orientation reads as visible, baselines reset on rotation. Estimation errors lean conservative - "visible" means "do not interfere" - so split-screen or a floating keyboard degrade to today's behavior, never to closing a keyboard mid-typing. - The panel-menu e2e contract test now covers both states: keyboard up (viewport shrunk) keeps focus and selection; keyboard down drops focus while the selection survives for stats and restore-ranges. Device matrix (API 35 emulator, real soft keyboard enabled): expand, collapse, panel switcher, and menu options all keep a dismissed keyboard dismissed; with the keyboard up, expanding keeps it up, the panel opens, and focus stays in the editor. The earlier false regression came from the emulator hardware-keyboard accessory bar (mInputShown=true with no panel); show_ime_with_hard_keyboard=1 restored real geometry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #200 — toolbar taps no longer resummon a keyboard the user just dismissed.
The chain, established on API 35
document.activeElement.Selection.addRange().Before this PR, expand, collapse, the panel switcher, and its options all reproduced the unwanted keyboard return. The API 35 device matrix verified that those navigation taps stay keyboard-free after the guard, while expanding with the IME already open preserves focus and the keyboard.
Implementation
pointerdownguard blurs editor-owned focus only when the IME is explicitly known to be hidden. Navigation taps then have no focused editable to resummon the keyboard for; edit commands restore their caret/focus through their existing Muya paths.WindowInsetsCompat.Type.ime()through the existingAndroidSelectionbridge. It publishes retainedimeVisibilityChangedevents and an initialgetImeVisibility()snapshot. Listener-first installation plus an event-version gate prevents a late snapshot from overwriting a newer event.adjustResize.unknown | hidden | visiblestates. Its first sample and every post-rotation sample areunknown; unknown means no intervention, never blur.Verification
vue-tsc -b, production build, focused ESLint, Android JVM tests, Java compilation, andassembleDebugall pass locally.d131e7efollow-up; current-head GitHub Web Quality, Android Connected Tests, and Android Debug Build were triggered on push.