Repository navigation
Conversation
A manual sample for a phone browser: a DropDownButton flyout that focuses its TextBox when it opens, on the page and inside a ContentDialog. It logs the window activation, XamlRoot changes and InputPane occlusion, to show what closes the flyout when the soft keyboard comes up.
Some browsers change the height of the layout viewport around the soft keyboard: they shrink it by the keyboard height (resizes-content), or hide and restore their bottom toolbar, which grows it while the keyboard is up or briefly when it hides. That was reported as a window resize, so XamlRoot.Changed light-dismissed the open popups: a flyout focusing its TextBox on open closed as soon as the keyboard came up. As in WinUI, the keyboard occludes the window instead. During a text entry started by touch, a shrink and a growth under the keyboard are held as InputPane occlusion, until the height comes back, the width changes, the keyboard goes down or a second after the text entry ends. Any other growth during or right after such a text entry is reported once it has lasted 300 ms. A height change during text entry started with a mouse is still reported at once. The pointer type is recorded by the window from startup: the TextBox extension only installs its listener with the first TextBox, which can be the one in the flyout that the tap opened.
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
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: closes #26662
PR Type:
🐞 Bugfix
What changed? 🚀
On Skia WebAssembly in a mobile browser, a flyout that focuses its
TextBoxwhen it opens can close as soon as the soft keyboard comes up. It was reported in Brave on an Android phone, with aDropDownButtonin aContentDialogwhose flyout focuses a search box onOpened.The report did not reproduce with Brave's default settings in an Android emulator: there the keyboard only shrinks the visual viewport, and nothing closes. This PR fixes the path where the height of the layout viewport changes around the keyboard. Forcing that with
interactive-widget=resizes-contentreproduces the report every time. The reporter confirmed the fix on their phone.Cause: when the layout viewport's height changes around the keyboard,
WebAssemblyWindowWrapperreports a window resize.XamlRoot.Changed→PopupRoot.CloseLightDismissablePopupscloses the flyout, focus leaves theTextBox, and the keyboard hides. A browser changes that height in two ways:interactive-widget=resizes-content);TextBoxstill focused, the layout grows 793 → 845 → 793 px over about 130 ms.In WinUI the touch keyboard never resizes the window: it occludes it, and
InputPanereports that.Fix (
WebAssemblyWindowWrapper.ts). A touch text entry is a text input that has focus after a touch or pen press:InputPane.OccludedRect, measured against the window size.TextBoxstill focused.TextBoxfocused or because the focus moved out.TextBoxhas focus).TextBox. In the report's layout, the firstTextBoxis the one in the flyout, so the tap that opened the flyout would not have been seen.BrowserRenderersizes the canvas from the window size rather than from the layout viewport.Behavior change: a page that opts into
interactive-widget=resizes-contentno longer has its window shrunk for the keyboard during a touch text entry. It gets the keyboard throughInputPane(bring-into-view, flyouts placed above the keyboard), as on WinUI.Relationship to #25387: that PR holds back height-only changes for 300 ms around a keyboard hide, which fixes the Edge blip in #25380. This PR uses its measurements but stands on its own:
Both change the same code and would conflict. This PR also moves the pointer type from
BrowserInvisibleTextBoxViewExtension.lastPointerTypetoWebAssemblyWindowWrapper.isTouchInput(). #25185 adds a read oflastPointerType: the two merge cleanly in git but don't compile together, so whichever lands second needs that one line changed.Validation:
Given_InputPane), seven new tests:When_Browser_Keyboard_Shrinks_Layout_Viewport_Then_Flyout_Stays_Open: after a touch press, a keyboard that shrinks the layout viewport, then hides. The window never changes size and the flyout stays open.When_Viewport_Blips_As_Soft_Keyboard_Hides_Then_Flyout_Stays_Open: fix(wasm): Keep popups open when the soft keyboard hides #25387's measured sequence. The keyboard comes up through the visual viewport and goes down, then the layout grows 52 px and comes back 150 ms later. The window never changes size and the flyout stays open.When_Viewport_Blips_After_Focus_Moves_Out_Then_Flyout_Stays_Open: the same blip, after the focus moved to a button in the flyout.When_Browser_Toolbar_Hides_Under_Keyboard_Then_Window_Keeps_Size: while the keyboard is up, the layout grows 52 px and stays grown. The window keeps its size and the flyout stays open; once the keyboard is down, the window takes the new height after the settle.When_Viewport_Grows_During_Text_Entry_Then_Window_Resized_Once_Settled: a growth that lasts is not reported after 50 ms, and is reported once settled.When_Text_Entry_Ends_With_Viewport_Still_Shrunk_Then_Window_Resized(synthetic): a held shrink is released once the text entry ends.When_Browser_Layout_Height_Changes_During_Mouse_Text_Entry_Then_Window_Resized: during a mouse text entry, a shrink and a growth are both reported at once.Given_InputPane,Given_Flyout,Given_Popup,Given_ContentDialog,Given_TextBox,Given_PasswordBox(480 tests): 437 passed, 11 failed, 32 inconclusive (skipped by platform or condition). Unmodified master with the same filter gives 473 tests, 430 passed, the same 11 failures and the same 32 skipped. The failures areCheck_Placement_All_*rounding at 125% scaling, theWhen_DefaultButton_*colors, and the iOS-onlyWhen_Touch_LongPress_Drag_Release_Does_Not_Open_Flyout_iOS.Windows.UI.ViewManagement/SoftKeyboardFocusedFlyout):interactive-widget=resizes-content: the layout shrank from 762 to 498 px,XamlRoot.Changedfired, the flyout closed and the keyboard hid. Same on the page and in aContentDialog. Also reproduced on an Android 14 emulator.XamlRoot.Changed,OccludedRectheight 264. On the page and in the dialog, the flyout stays open above the keyboard and typing works. Back hides the keyboard with theTextBoxstill focused: no resize, flyout open. Tapping a list item hides the keyboard: no resize, flyout open.net11.0-browserwasm). The WinAppSDK build was not compiled; the sample's Uno-onlyXamlRoot.HostWindowis behind#if HAS_UNO(code review).TextBoxalready exists before the flyout opens.PR Checklist ✅
Screenshots Compare Test Runresults.