Skip to content

fix(skia): Keep keyboard occlusion pad out of the content arrange - #24410

Merged
ajpinedam merged 2 commits into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.skia.keyboard.occlusion.arrange
Sep 5, 2026
Merged

ajpinedam merged 2 commits into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.skia.keyboard.occlusion.arrange

Conversation

@ajpinedam

@ajpinedam ajpinedam commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #24409

PR Type:

🐞 Bugfix

What changed? 🚀

When the soft keyboard opens, InputPane pads the nearest constrained ScrollContentPresenter by the full keyboard overlap, so that the minimal BringIntoView which follows lands the focused element flush above the input pane. That padding shrinks the layout viewport, so content that sizes itself to the viewport gets re-arranged into the smaller box: a sign-in card centered in a Grid inside a full-window ScrollViewer jumps up by half the keyboard height even when the focused field was never occluded, and the area behind the keyboard is squeezed out of the content instead of becoming scrollable.

The presenter now arranges its content against the un-occluded height:

childRect.Height = Math.Max(finalSize.Height + _occludedRectPadding.Bottom, desiredSize.Height);

The viewport still shrinks — that is what makes BringIntoView stop above the keyboard — but the pad turns into scrollable extent rather than moving viewport-sized content. It is a strict no-op whenever no occlusion pad is applied (_occludedRectPadding.Bottom == 0), i.e. whenever the keyboard is down.

This is the regression half of 6f6bd62 (fix(skia): Fix keyboard occlusion scroll padding, in 6.7.103). That commit correctly replaced a pad that was never large enough to move a genuinely occluded field; this PR keeps that behavior and removes the layout side effect it introduced.

Measured on Skia Desktop (viewport 768, occlusion 307.2):

pad bottom viewport extent card top
before this PR 307.2 461 461 284 → 130.5
after this PR 307.2 461 768 284 → 284

Validation

  • New runtime test Given_InputPane.When_Focused_Element_Not_Occluded_Then_Centered_Content_Is_Not_Moved, verified fail-before / pass-after on master (fails with "Centered card moved by 153.5px although nothing was occluded", passes with the fix). It waits for the pad to actually be applied before asserting, so it cannot pass vacuously, and it also asserts that the extent grows by the occlusion and that the viewport still shrinks.
  • New runtime test Given_InputPane.When_App_Ensured_Focused_Element_In_View_Then_No_Pad_Is_Applied, covering the WinUI opt-out (InputPaneVisibilityEventArgs.EnsuredFocusedElementInView) on the same code path.
  • New runtime test Given_InputPane.When_Occluded_Field_In_Viewport_Sized_Content_Then_Scrolled_Above_Occlusion, guarding the bring-into-view contract in the geometry this change actually alters: content that sizes itself to the viewport with the focused field behind the keyboard. It passes both before and after by design — before, the field was squeezed above the keyboard by the shrunken arrange; after, the scroll does the work — which is the point: the guarantee holds either way. The two pre-existing occlusion tests use content ~2040px tall, where this change is a mathematical no-op (desired already exceeds viewport + pad), so they could not have shown this.
  • The three existing Given_InputPane tests (the 6f6bd62 coverage) still pass — the occluded-field bring-into-view behavior is unchanged.
  • Regression sweep: all 55 Given_ScrollViewer / Given_ScrollViewer_Zoom runtime tests pass (4 skipped), plus 33 ScrollViewerTests.Given_ScrollViewer_Anchoring / _ScrollChaining.
  • All runs on the Skia Desktop head (macOS) against master.

Reported by a customer on 6.7.103; a backport to release/stable/6.7 should follow once this merges, where the same change was validated on the branch directly.

PR Checklist ✅

Copilot AI lite review requested due to automatic review settings September 4, 2026 17:42

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.

🟢 Approval recommended

The change is narrowly scoped, aligns with the described regression, and is backed by targeted Skia runtime tests covering both the regression scenario and the opt-out path.

Pull request overview

This PR fixes a Skia InputPane keyboard-occlusion regression where applying the occlusion pad reduced the layout viewport and unintentionally re-arranged viewport-sized content (e.g., centered sign-in cards). The ScrollContentPresenter now arranges content against the un-occluded height so the occlusion pad contributes to scrollable extent rather than shifting viewport-sized layouts.

Changes:

  • Update ScrollContentPresenter.ArrangeOverride to add back the occlusion-pad height when computing the child arrange rect height.
  • Add Skia runtime coverage to ensure centered (non-occluded) content doesn’t move when occlusion padding is applied, and to validate the EnsuredFocusedElementInView opt-out path.
File summaries
File Description
src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs Arrange content using finalSize.Height + _occludedRectPadding.Bottom so occlusion padding increases extent instead of reflowing viewport-sized layouts.
src/Uno.UI.RuntimeTests/Tests/Windows_UI_ViewManagement/Given_InputPane.cs Add runtime tests covering “non-occluded centered content stays put” and the app opt-out (EnsuredFocusedElementInView) behavior on Skia.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@unodevops

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings September 4, 2026 18:16

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.

🟢 Approval recommended

The behavioral change is narrowly scoped, aligns with the described regression, and is backed by targeted Skia runtime tests covering both the regression and the bring-into-view contract.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 232171 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageIconPage.png-dark
    • DisplayInformation.png-dark
    • Image_AnimatedWebP.png-dark
    • Image_AnimatedWebP.png
  • skia-windows-screenshots: 2310 changed over 2402

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AppBarToggleButtonTest.png-dark
    • AppWindowClosing.png-dark
    • AppWindowPositionAndSize.png
    • AppXamlDefinedResources.png-dark
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Demo.png
    • AutoBorderStretchwithtopmargin.png-dark
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • BackGesture.png-dark
    • BackGesture.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • Battery.png-dark
    • Battery.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@ajpinedam
ajpinedam enabled auto-merge September 4, 2026 21:05
@unodevops

Copy link
Copy Markdown
Contributor

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

@ajpinedam
ajpinedam merged commit 1fc6be9 into unoplatform:master Sep 5, 2026
52 checks passed
@ajpinedam

Copy link
Copy Markdown
Contributor Author

@Mergifyio backport servicing/6.8

@mergify

mergify Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

backport servicing/6.8

✅ Backports have been created

Details

@ajpinedam
ajpinedam deleted the dev/anpi/fix.skia.keyboard.occlusion.arrange branch September 6, 2026 04:16
@ajpinedam

Copy link
Copy Markdown
Contributor Author

@Mergifyio backport release/stable/6.7

@mergify

mergify Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.7

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request Sep 10, 2026
…r-24410

fix(skia): Keep keyboard occlusion pad out of the content arrange (backport #24410)
agneszitte added a commit that referenced this pull request Sep 11, 2026
…6.7/pr-24410

fix(skia): Keep keyboard occlusion pad out of the content arrange (backport #24410)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soft keyboard occlusion re-arranges ScrollViewer content that sizes itself to the viewport

5 participants