Skip to content

Android: Fixed keyboard switcher immediately closing after it opens on the Google Pixel 10. - #97

Merged
JSKitty merged 1 commit into
VectorPrivacy:masterfrom
th2tran:gboard-fix
Nov 4, 2026
Merged

JSKitty merged 1 commit into
VectorPrivacy:masterfrom
th2tran:gboard-fix

Conversation

@th2tran

@th2tran th2tran commented Nov 4, 2026 •

Copy link
Copy Markdown

Root cause:
the bug is in the Android System WebView (156.0.8078.47), not in Vector's own code (Chromium issue crbug.com/560321831). This WebView version hides the keyboard whenever the app's window loses focus. Gboard's keyboard switcher takes that focus when it opens, so the keyboard was hidden and the switcher closed straight away. A debugger stack trace showed the hide coming from WebView's own input code. Chromium has since changed this to stop hiding the keyboard.

Fix (MainActivity.kt):
the WebView now sits inside a small wrapper. While the keyboard is showing, the wrapper doesn't pass a focus-loss signal on to the WebView. If the app is actually being left, the held signal is passed on in onPause.

Expected to be unaffected:
• Other keyboards (Samsung, SwiftKey, older Gboard): they just get the same fix if their switcher steals focus. If they don't, nothing changes.
• Older WebView versions, or future ones with Chromium's fix: holding back the focus loss only skips a keyboard reset that isn't needed there.
• Older Android versions: if the keyboard-visible check misreads on an older device, the code falls back to the old behaviour.
• Read receipts and the window-active state: Tauri gets focus changes from the activity directly, not through the view tree, so these still work.
• Layout, side-edge gestures and Mini App overlays: the wrapper fills the screen, and no Vector code or bundled Tauri plugin assumes the WebView is the top-level view.

Small behaviour changes:
• Notification shade or a system dialog opened while typing: the keyboard now stays up behind it, as it does in native apps. The page also no longer gets a blur event at that moment, so a tooltip or context menu may stay open until you return. Leaving the app still hands the WebView the focus loss.
• Split-screen or freeform windows (foldables, tablets): if focus moves to the other app while Vector's keyboard is up, Vector isn't paused, so the WebView keeps acting focused (for example, a blinking cursor) until you return. This is cosmetic.

Known gap: Mini App WebViews aren't wrapped, so the keyboard switcher may still close inside Mini Apps on affected WebView versions. I can wrap them the same way if you want.

Video recording of bug behaviour:
https://github.com/user-attachments/assets/39813ad0-b858-4e99-8024-e07d8e8d2e18

Video recording of bug fix:
https://github.com/user-attachments/assets/ae020c89-86e0-4db6-b85b-0fd1654354ca

…n the Google Pixel 10.

Root cause: the bug is in the Android System WebView (156.0.8078.47), not in Vector's own code (Chromium issue crbug.com/560321831). This WebView version hides the keyboard whenever the app's window loses focus. Gboard's keyboard switcher takes that focus when it opens, so the keyboard was hidden and the switcher closed straight away. A debugger stack trace showed the hide coming from WebView's own input code. Chromium has since changed this to stop hiding the keyboard.

Fix (MainActivity.kt): the WebView now sits inside a small wrapper. While the keyboard is showing, the wrapper doesn't pass a focus-loss signal on to the WebView. If the app is actually being left, the held signal is passed on in onPause.

Expected to be unaffected:
• Other keyboards (Samsung, SwiftKey, older Gboard): they just get the same fix if their switcher steals focus. If they don't, nothing changes.
• Older WebView versions, or future ones with Chromium's fix: holding back the focus loss only skips a keyboard reset that isn't needed there.
• Older Android versions: if the keyboard-visible check misreads on an older device, the code falls back to the old behaviour.
• Read receipts and the window-active state: Tauri gets focus changes from the activity directly, not through the view tree, so these still work.
• Layout, side-edge gestures and Mini App overlays: the wrapper fills the screen, and no Vector code or bundled Tauri plugin assumes the WebView is the top-level view.

Small behaviour changes:
• Notification shade or a system dialog opened while typing: the keyboard now stays up behind it, as it does in native apps. The page also no longer gets a blur event at that moment, so a tooltip or context menu may stay open until you return. Leaving the app still hands the WebView the focus loss.
• Split-screen or freeform windows (foldables, tablets): if focus moves to the other app while Vector's keyboard is up, Vector isn't paused, so the WebView keeps acting focused (for example, a blinking cursor) until you return. This is cosmetic.

Known gap: Mini App WebViews aren't wrapped, so the keyboard switcher may still close inside Mini Apps on affected WebView versions. I can wrap them the same way if you want.
@JSKitty
JSKitty merged commit 21f24e8 into VectorPrivacy:master Nov 4, 2026
@JSKitty

JSKitty commented Nov 4, 2026

Copy link
Copy Markdown

Tested and confirmed this fix using the specified WebView versions installed on an emulator, massively appreciate the PR, you will be included in the Vector v0.5.0 Release Notes. 🙏 💚 @th2tran

@YuurinBee

Copy link
Copy Markdown

Appreciate the in-depth issue report with source/videos, @th2tran. Ideal report & resolve ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants