Repository navigation
Description
Current behavior 🐛
On Skia WebAssembly in a mobile browser, a flyout that focuses a TextBox when it opens can show for a moment and then close, together with the on-screen keyboard.
My setup: a DropDownButton inside a ContentDialog. Its Flyout (Placement="BottomEdgeAlignedLeft") holds a TextBox and a ListView, and Flyout.Opened calls SearchBox.Focus(FocusState.Programmatic). A user reported it on an Android phone in Brave.
With Brave's default settings in an Android emulator, I could not reproduce it: there the keyboard only shrinks the visual viewport. It does reproduce when the keyboard changes the height of the layout viewport. With interactive-widget=resizes-content in the viewport meta, this happens on every open, with the button on the page or inside the dialog. What closes it, from logs of the window size, the visual viewport and XamlRoot.Changed:
- The
TextBoxtakes focus and the keyboard comes up. - The layout viewport shrinks from 762 to 498 CSS px. The width stays the same.
WebAssemblyWindowWrapperreports that as a window resize.XamlRoot.Changedis raised with the new size, andPopupRootlight-dismisses the open popups.- With the flyout gone, the
TextBoxloses focus, the keyboard hides, and the window gets its old size back.
The window is not deactivated at any point: there is no blur and no Window.Activated.
The layout height can also change around the keyboard because a browser hides and restores its bottom toolbar. #25387 measured that in Edge. I did not see Brave do it in the emulator.
Expected behavior 🎯
Showing the keyboard leaves the flyout open, as on WinUI. There the touch keyboard never resizes the window: it occludes it, and the app sees that through InputPane.OccludedRect.
How to reproduce it (as minimally and precisely as possible) 🔬
- Run a Skia WASM app with this page in an Android browser:
<DropDownButton Content="Pick">
<DropDownButton.Flyout>
<Flyout x:Name="PickerFlyout" Placement="BottomEdgeAlignedLeft" Opened="OnOpened">
<StackPanel Width="280" Spacing="8">
<TextBox x:Name="SearchBox" PlaceholderText="Search..." />
<ListView MaxHeight="240" ItemsSource="{x:Bind Items}" />
</StackPanel>
</Flyout>
</DropDownButton.Flyout>
</DropDownButton>private void OnOpened(object sender, object e) => SearchBox.Focus(FocusState.Programmatic);- Add
interactive-widget=resizes-contentto the page's viewport meta, so the keyboard resizes the layout viewport. - Tap the button. The flyout opens, the keyboard starts to show, then both close.
Workaround 🛠️
None from the app for the toolbar case. Where the keyboard itself resizes the layout and the browser honors it, interactive-widget=resizes-visual in the viewport meta avoids it.
Affected platforms 📱💻🖥️
WebAssembly
Uno.Sdk version (and other relevant versions) 📦
Reported on Uno 6.8, on Android 17 with Brave 1.99.57. Reproduced on master with interactive-widget=resizes-content, in an Android 14 and an Android 16 emulator with Brave 1.100.58 (Chromium 158).
IDE version 🧑💻
Not relevant (runtime behavior).
Anything else we need to know? 💬
Related: #25380, where the keyboard hiding closes popups in Edge because its toolbar briefly makes the layout taller (measured in #25387). Both come from the same thing: during text entry, a change of the layout viewport's height alone is reported as a window resize.
Activity