fix(wasm): iPad soft-keyboard focus (dismiss, LostFocus, bring-into-view) - #23890
Draft
ajpinedam wants to merge 3 commits into
Draft
fix(wasm): iPad soft-keyboard focus (dismiss, LostFocus, bring-into-view)#23890ajpinedam wants to merge 3 commits into
ajpinedam wants to merge 3 commits into
Conversation
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23890/wasm-skia-net9/index.html |
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.
GitHub Issue: Associated with an internal tracking issue (customer-reported).
PR Type:
🐞 Bugfix
What changed? 🚀
Fixes three focus-related bugs specific to the Skia WebAssembly head on touch devices (iPad Safari/Chrome). All three stem from the single shared, invisible
<input id="uno-input">that is positioned over the one<canvas>used for all text entry. None of them affect desktop Skia, WinUI, or the native (non-Skia) heads.1. Soft keyboard opens on a
TextBoxtap, then immediately dismisses itself.Touch browsers synthesize a trailing compatibility
mousedownafter a tap's focus change; it lands on the non-focusable canvas and its default action blurs the just-focused#uno-input, closing the keyboard. Uno alreadypreventDefaults pointer events, but per the Pointer Events spec that does not suppress the synthesized mouse-compatibility events. Fix: a one-shot, touch/pen-scoped guard that swallows the single trailing canvasmousedown/clickfollowing the input'sfocusin(armed onfocusin, disarmed on the nextpointerdown). Desktop mouse is unaffected — theremousedownprecedes focus, so the guard never arms.2.
LostFocusnever fires when the keyboard is dismissed this way.Focus was driven one-way (managed → native): nothing listened for the browser blurring
#uno-inputon its own, soFocusManagerstayed out of sync andLostFocusnever fired. Fix: ablurlistener on the input reports genuine, browser-initiated blurs to a newOnNativeBlurexport, which callsTextBox.Unfocus()— the same terminal focus-clearing path the iOS and native WASM heads already use. Managed-initiated blurs are suppressed so a focus switch never clears the wrong control.3. A focused field near the bottom is not scrolled above the keyboard.
The Skia WASM head had no
InputPaneproducer — nothing ever setInputPane.OccludedRect, so the shared bring-into-view path never ran. Fix: avisualViewportlistener computes the keyboard occlusion (gated on the invisible input being focused, so browser-chrome resizes don't count) and feedsInputPane.OccludedRect, mirroring the iOS/Android heads. The consuming logic (InputPane.skia.cs→ScrollContentPresenter.Pad+StartBringIntoView) already shipped in the WASM build; this only supplies the missing producer. This also makesInputPane.Showing/Hidingfire on this head, matching the other platforms.Validation
SamplesApp.Skia.WebAssembly.Browserapp.Given_InputPane.When_OccludedRect_Set_Then_Focused_TextBox_Scrolled_Into_Viewpasses on Skia Desktop — it exercises the device-independent consumer path (issue 3).SoftKeyboardFocusTests(GotFocus/LostFocus counters, liveOccludedRectreadout, bottom field). Issues 1 and 2, and the on-device occlusion computation, reproduce only on a real iPad (not the iOS Simulator or desktop-browser emulation), so final device validation there is still required — this PR is a draft pending that.PR Checklist ✅
Screenshots Compare Test Runresults.