Sitelet https://github.com/unoplatform/uno/pull/24947
Skip to content

fix(inputpane): Scroll root content above the keyboard - #24947

Merged
ajpinedam merged 5 commits into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.inputpane.occluded.root.pan
Oct 5, 2026
Merged

ajpinedam merged 5 commits into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.inputpane.occluded.root.pan

Conversation

@ajpinedam

Copy link
Copy Markdown
Contributor

GitHub Issue: related to unoplatform/kahua-private#512

PR Type:

🐞 Bugfix

What changed? 🚀

On Skia targets, a focused field could stay clipped or hidden behind the on-screen keyboard. This happened whenever the field's nearest ScrollViewer could not move it high enough, for example a details side panel whose ScrollViewer starts just above the keyboard's top edge (and worse in iPad Safari with the tab bar showing). InputPane only padded and scrolled that one ScrollContentPresenter, and nothing moved the rest of the content. In WinUI, the RootScrollViewer shrinks to the area above the input pane and scrolls the whole content instead. This PR replaces the padding with the equivalent of that RootScrollViewer. While the input pane is shown, the window's root element (RootVisual or XamlIslandRoot, through UnoRootElementLogic) acts as the outermost bring-into-view scroller, with a viewport that ends at the top of the pane. It offsets the public root visual when the focused element, padded by WinUI's 20px, still sits below that viewport, and resets the offset when the pane hides. InputPane now requests a non-animated bring-into-view, as WinUI does. Two related fixes: ScrollContentPresenter's bring-into-view used the DesiredSize-based viewport, which dropped requests coming from content stretched taller than it asks for instead of forwarding them to outer scrollers; and AutoSuggestBox now places its suggestion list in window coordinates, since the content can be offset. Given_InputPane now covers a side panel that starts near the keyboard, a field outside any ScrollViewer, focus moving while the keyboard is up, hit-testing after the content moves, restoring the content when the keyboard hides, and an app that handles Showing itself. Given_ScrollViewer covers the nested stretched-content case. Both fail without the fix. The change was also checked manually on an iPad in Safari with the SoftKeyboardFocusTests sample, whose steps are updated for the new behavior.

PR Checklist ✅

Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:05
@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label Oct 2, 2026

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

XAML-island root selection is ineffective, and the new tests have cleanup and coverage gaps.

Review effort: Balanced
Findings: 3 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Adds root-level scrolling to keep focused controls above the on-screen keyboard across Skia targets.

Changes:

  • Introduces input-pane viewport and root-offset handling.
  • Corrects nested scrolling and popup coordinate calculations.
  • Expands runtime tests and updates the keyboard sample.
File Description
UnoRootElementLogic.cs Implements root viewport scrolling.
RootVisual.uno.cs Handles bring-into-view requests.
RootVisual.cs Applies the root content offset.
XamlIslandRoot.uno.cs Integrates island bring-into-view handling.
XamlIslandRoot.Core.cs Offsets island content.
IRootElement.cs Exposes root-element logic.
ScrollContentPresenter.OccludedPadding.cs Removes legacy keyboard padding.
ScrollContentPresenter.mux.cs Uses actual ScrollViewer viewport dimensions.
ScrollContentPresenter.cs Removes padded-height arrangement.
AutoSuggestBox.cs Positions suggestions in window coordinates.
InputPane.cs Drives root viewport and focused-element scrolling.
Given_InputPane.cs Expands keyboard-occlusion coverage.
Given_ScrollViewer.cs Tests nested stretched-content scrolling.
SoftKeyboardFocusTests.xaml.cs Updates manual test guidance.
SoftKeyboardFocusTests.xaml Updates sample instructions.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Uno.UI.RuntimeTests/Microsoft/UI/Xaml/Controls/Given_ScrollViewer.cs Outdated
Comment thread src/Uno.UI.RuntimeTests/Windows/UI/ViewManagement/Given_InputPane.cs Outdated
Comment thread src/Uno.UI/UI/ViewManagement/InputPane/InputPane.cs
Comment thread src/Uno.UI/UI/Xaml/Controls/AutoSuggestBox/AutoSuggestBox.cs
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24947/wasm-skia-net9/index.html

Copilot AI balanced review requested due to automatic review settings October 2, 2026 16:07

Copilot AI 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.

Copilot review overview

🔵 Needs a closer look

The root offset limit prevents tall root content from scrolling far enough to reveal later focused fields.

Review effort: Balanced
Findings: None

Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Root scrolling ignores the public root visual's full height

src/​Uno.UI/​UI/​Xaml/​Internal/​UnoRootElementLogic.cs:78

This caps root scrolling to the host window height, not the public root visual's extent. XamlIslandRoot.ArrangeOverride explicitly allows that visual to be taller than the host (Math.Max(finalSize.Height, childDesiredSize.Height)), so moving focus to a field farther down a tall root StackPanel while the keyboard is open can require more than the keyboard-height offset and will remain occluded. Compute the maximum from the larger of the host and public-root heights (and cover a tall root without an inner ScrollViewer).

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24947/wasm-skia-net9/index.html

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237023 found UI Test snapshots differences: skia-linux-screenshots: 107, skia-windows-screenshots: 156

Details
  • skia-linux-screenshots: 107 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • DisplayInformation.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Image_AnimatedWebP.png-dark
    • Image_AnimatedWebP.png
  • skia-windows-screenshots: 156 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Grid_Spacing_Adjustable.png-dark
    • Grid_Spacing_Adjustable.png
    • Grid_Star_Auto_WithTextblock.png-dark
    • Grid_Star_Auto_WithTextblock.png
    • Grid_Style_Local_Override.png-dark
    • Grid_Style_Local_Override.png
    • Grid_Two_bottom_row_Auto__middle_col_auto.png-dark
    • Grid_Two_bottom_row_Auto__middle_col_auto.png
    • ImageSourceUrlMsAppDataScheme.png-dark
    • ImageSourceUrlMsAppDataScheme.png

@ajpinedam
ajpinedam enabled auto-merge October 2, 2026 17:23
@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 237023 has failed on Uno.UI - CI.

@mergify

mergify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@ajpinedam
ajpinedam merged commit 9824cf1 into unoplatform:master Oct 5, 2026
52 checks passed
@ajpinedam
ajpinedam deleted the dev/anpi/fix.inputpane.occluded.root.pan branch October 5, 2026 16:06
@ajpinedam

Copy link
Copy Markdown
Contributor Author

@mergify backport servicing/6.8

@mergify

mergify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

backport servicing/6.8

✅ Backports have been created

Details

Cherry-pick of 1b9aeab has failed:

On branch mergify/bp/servicing/6.8/pr-24947
Your branch is ahead of 'origin/servicing/6.8' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 1b9aeab.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   src/Uno.UI.RuntimeTests/Tests/Windows_UI_ViewManagement/Given_InputPane.cs
	modified:   src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs
	modified:   src/Uno.UI/UI/Xaml/Internal/IRootElement.cs
	modified:   src/Uno.UI/UI/Xaml/Internal/Islands/XamlIslandRoot.Core.cs
	modified:   src/Uno.UI/UI/Xaml/Internal/Islands/XamlIslandRoot.uno.cs
	modified:   src/Uno.UI/UI/Xaml/Internal/RootVisual.cs
	new file:   src/Uno.UI/UI/Xaml/Internal/RootVisual.uno.cs
	modified:   src/Uno.UI/UI/Xaml/Internal/UnoRootElementLogic.cs

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   src/Uno.UI/UI/ViewManagement/InputPane/InputPane.cs
	deleted by them: src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.OccludedPadding.cs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants