Skip to content

feat(textbox): Honor PreventKeyboardDisplayOnProgrammaticFocus - #25995

Merged
MartinZikmund merged 3 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/textbox-prevent-keyboard-display
Nov 6, 2026
Merged

MartinZikmund merged 3 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/textbox-prevent-keyboard-display

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: part of #9080 (flaky tests roundup), related to #25227

PR Type:

✨ Feature

What changed? 🚀

TextBox.PreventKeyboardDisplayOnProgrammaticFocus and PasswordBox.PreventKeyboardDisplayOnProgrammaticFocus were generated [NotImplemented] stubs, so a programmatic focus always opened the software keyboard. They now work as in WinUI: with the property set, Focus(FocusState.Programmatic) keeps the keyboard hidden until the user taps the box. RichEditBox already honored it.

  • TextBoxCore decides whether to suppress the keyboard when platform text input starts, and passes that to the text box view (iOS, WASM), to the IME session activation, and to the Android focus notification, which no longer calls ShowTextInput while suppressed.
  • The focus origin is read from the focus manager's real focus state. FocusState itself is coerced to the last input device, so a programmatic focus reads as Pointer after any pointer input.
  • A tap on the focused box re-runs the platform text input without suppression. It needs explicit handling: tapping an already-focused box leaves the focus origin programmatic.

Why now: Given_InputPane flakiness on Android

The Given_InputPane tests simulate a keyboard by setting InputPane.OccludedRect, then focus their fields programmatically. On the Android emulator, that focus also opened the real soft keyboard, and ApplicationActivity.OnKeyboardChanged wrote its insets into the same OccludedRect whenever it showed or hid, overriding the simulated value. In the last 150 CI builds this failed When_Focus_Moves_While_Occluded_Then_New_Field_Brought_Above_Occlusion in 18 builds and When_OccludedRect_Cleared_Then_Content_Restored in 5, plus other tests of the class less often, also on the 6.7 and 6.8 branches:

Microsoft.UI.Xaml.Controls.TextBox (top 480, bottom 520) was not brought above the keyboard top (400).
The TextBox did not return to its position once the keyboard hid (top 720, was 432).

CI device logs show the real keyboard showing (InsetsController: show(ime()), ImeTracker ... onShown) during those tests. The tests now set PreventKeyboardDisplayOnProgrammaticFocus on their fields. #25227's two skipped tests may have the same cause (its iOS gap is about a keyboard height); they are not re-enabled here.

Validation

  • New runtime tests Given_TextBox_PreventKeyboardDisplay: default value; the IME activation is suppressed only for a programmatic focus with the property set (Programmatic/Pointer/Keyboard, on and off); PasswordBox; a real injected tap on a programmatically focused box opens the keyboard (desktop only: the injected touch doesn't reach the TextBox on the Android emulator).

  • Skia desktop (Windows): Given_TextBox_PreventKeyboardDisplay, Given_TextBox, Given_PasswordBox, Given_RichEditBox, Given_ImeSessionCoordinator_RootOwnership, Given_InputPane: 1413 passed, 0 failed.

  • Android emulator (API 34): Given_InputPane and the new tests, 5 iterations each with no retries: all pass (one already skipped on Android). Real keyboard activity during the Given_InputPane run, from logcat:

    keyboard show requests keyboard shown
    master 23 3
    this PR 0 0
  • The failure itself did not reproduce on the local emulator (master's Given_InputPane also passes 5 iterations there, AOSP keyboard vs CI's Gboard on API 36), so the CI Android lanes are the real check of the flakiness.

  • Uno.UI and Uno.UI.Runtime.Android build with analyzers.

  • Not verified: the tap-to-open path on Android (no working touch injection on the TextBox there), and iOS.

PR Checklist ✅

🤖 Generated with Claude Code

@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia labels Nov 3, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 243404 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppBarButtonTest.png
    • ApplicationViewMode.png
    • AppWindowPositionAndSize.png-dark
    • ArcSegment.png-dark
    • Attributed_text_Supserscript.png-dark
    • AutoBorderStretchwithleftmargin.png-dark
    • AutomationPropertiesExtensions_Role.png
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBox_Description.png
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BezierSegment.png-dark
    • BezierSegment.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • BorderTopwithmargins.png-dark
    • BorderTopwithmargins.png
  • skia-windows-screenshots: 2458 changed over 2492

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AppBarButtonWithIconTest.png-dark
    • ApplicationViewMode.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowFeatures.png
    • AppXamlDefinedResources.png-dark
    • Attributed_text_FontSize_Changing.png
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoBorderStretchwithbottommargin.png
    • AutomationProperties_Landmark.png-dark
    • AutomationProperties_Landmark.png
    • AutoSuggestBox_Icons.png-dark
    • AutoSuggestBox_Icons.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BeginTime_MultipleAnimations.png-dark
    • BeginTime_MultipleAnimations.png
    • BitmapIcon_Foreground.png-dark
    • BitmapIcon_Foreground.png

@Xiaoy312 Xiaoy312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: it reuses RichEditBox's suppression path, and the Android red is the known order-dependent Given_TextBox ScrollViewer trio, unrelated to this PR. A few non-blocking notes inline. The iOS one is the only one I'd want a follow-up for.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@github-actions github-actions Bot added platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Nov 5, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244024 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AnimatedBackVisualSourceSamplePage.png
    • AppBarToggleButtonTest.png-dark
    • AppBarButtonTest.png
    • AppBar_KeyBoard.png
    • ApplicationViewMode.png-dark
    • Application_DispatcherShutdownMode.png-dark
    • AppWindowClosing.png-dark
    • AppWindowPresenters.png
    • AppWindowPresenters.png-dark
    • Arrange_Performance01.png
    • ArcSegment.png
    • AuthenticationBroker_Cancel.png
    • AuthenticationBroker_Cancel.png-dark
    • AutoBorderStretchwithtopmargin.png
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_StructureAndProps.png
    • AutomationProperties_Relations.png
    • AutoSizedPathCentered.png-dark
    • AutomationProperties_StructureAndProps.png-dark
  • skia-windows-screenshots: 2458 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarButtonTest.png-dark
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowFeatures.png-dark
    • AppWindowPresenters.png
    • ArcSegment.png
    • Attributed_text_Supserscript.png
    • AuthenticationBroker_Cancel.png-dark
    • AutomationPropertiesExtensions_Role.png-dark
    • AutomationPropertiesExtensions_Role.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_Reason.png-dark
    • AutoSuggestBox_Reason.png
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • BasicEnability.png-dark
    • BasicEnability.png

@ramezgerges
ramezgerges force-pushed the dev/rara/textbox-prevent-keyboard-display branch from 33a00c2 to 3e6e042 Compare November 5, 2026 17:54
ramezgerges and others added 3 commits November 5, 2026 12:54
TextBox and PasswordBox declared it as a NotImplemented stub, so a
programmatic focus always opened the software keyboard. It now keeps the
keyboard hidden, as in WinUI, until the user taps the box. The focus
origin comes from the focus manager: FocusState is coerced to the last
input device.

The InputPane tests simulate the keyboard through OccludedRect, and on
the Android emulator the real keyboard their programmatic focus opened
reported its own occlusion over the simulated one. They now keep it
hidden.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The tap that opens a keyboard a programmatic focus kept hidden set a
flag that stayed until the box lost focus, so every later text input
restart on the same focus, a programmatic one included, was taken for
a tap. The tap now travels with its own request instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
On iOS a suppressed keyboard now swaps in an empty InputView instead of
skipping the first responder, so hardware keyboards still type. The view
gets the focus origin, and a tap on an already-focused box re-shows the
keyboard from OnTapped (as WinUI does), so a drag-select doesn't.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 244079 found UI Test snapshots differences: skia-linux-screenshots: 2458, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 2458 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • ApplicationViewMode.png
    • AppWindowClosing.png
    • AppWindowTitleBar Properties.png
    • Attributed_text_FontSize_Changing.png-dark
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithbottommargin.png
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • AutoSizedTopLeft.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBox_Keyboard.png-dark
    • AutoSuggestBox_Keyboard.png
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png
    • BasicThemeResources.png-dark
    • BasicThemeResources.png
    • BitmapIcon_Generic.png-dark
    • BitmapIcon_Generic.png
  • skia-windows-screenshots: 2458 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarButtonTest.png-dark
    • AppBarToggleButtonTest.png
    • ApplicationViewSizing.png-dark
    • AppWindowPresenters.png-dark
    • ArcSegment.png-dark
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithleftmargin.png-dark
    • AutoBorderStretchwithleftmargin.png
    • AutomationProperties_Name.png-dark
    • AutomationProperties_Name.png
    • AutoSizedTopLeft.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBox_Description.png
    • AutoSuggestBox_SoftKeboard.png-dark
    • AutoSuggestBox_SoftKeboard.png
    • BasicEnability.png-dark
    • BasicEnability.png

@MartinZikmund
MartinZikmund merged commit 451ab34 into unoplatform:master Nov 6, 2026
45 of 48 checks passed
MartinZikmund added a commit that referenced this pull request Nov 7, 2026
Linux snapshot runs began segfaulting on exit once #25995 added this
diagnostic sample: 24 of 44 runs since, 0 of 64 before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu1pmTF7nEsciGTG9rw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants