Skip to content

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

Closed

Description

@ajpinedam

Current behavior 🐛

When the on-screen keyboard appears, Uno pads the nearest constrained ScrollViewer by the full keyboard overlap so that the BringIntoView which follows lands the focused element right above the input pane.

That padding shrinks the layout viewport, so content that sizes itself to the viewport is re-arranged into the smaller box. A sign-in card centered in a Grid inside a full-window ScrollViewer therefore jumps up by half the keyboard height as soon as the keyboard opens — even when the focused field sits well above the keyboard and nothing was ever occluded.

Measured with a runtime test on Skia Desktop (viewport 768, occlusion 307.2):

pad bottom viewport extent card top
keyboard hidden 0 768 768 284
keyboard shown 307.2 461 461 130.5 (−153.5 = half the occlusion)

This is a regression introduced by 6f6bd62 (fix(skia): Fix keyboard occlusion scroll padding, shipped in 6.7.103), which changed the pad from "the amount the focused element is occluded by" to the full overlap. The previous formula avoided this symptom, but was itself broken: it never padded enough to make BringIntoView move a genuinely occluded field, which is the bug that commit fixed.

Expected behavior 🎯

Content that is not occluded should stay exactly where it is. The keyboard overlap should become scrollable extent rather than being squeezed out of the content, so that fields behind the keyboard can still be brought into view.

How to reproduce it (as minimally and precisely as possible) 🔬

On a Skia mobile head (Android / iOS / WebAssembly on a touch device):

<ScrollViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <Grid>
        <Border Width="300" Height="200"
                HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBox PlaceholderText="user" Height="40" />
        </Border>
    </Grid>
</ScrollViewer>
  1. Run the app and tap the TextBox to open the soft keyboard.
  2. The centered card jumps upward by half the keyboard height, although it was never covered by the keyboard.

Device-independent repro as a runtime test: set InputPane.GetForCurrentView().OccludedRect to the bottom 40% of the window while the TextBox is focused, and compare the card's position before and after.

Workaround 🛠️

Pin the ScrollViewer content's MinHeight to the ScrollViewer's own ActualHeight on SizeChanged (padding does not change the ActualHeight of the element it is set on, so that is the un-occluded height). The card then keeps centering on the full window and the keyboard overlap becomes scrollable extent, so BringIntoView still works for genuinely occluded fields.

Alternatively, handle InputPane.Showing and set args.EnsuredFocusedElementInView = true — but that opts out of the framework adjustment entirely, so occluded fields will no longer be scrolled into view.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

Android, iOS, WebAssembly

Uno.Sdk version (and other relevant versions) 📦

6.7.22 (Uno.WinUI 6.7.103); also reproduces on master.

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

Customer-reported on 6.7.103. A fix is on the way.

Activity

  1. Jen-Uno commented on Sep 30, 2026

    @Jen-Uno
    Contributor

    QA: closing out without a manual pass. The fix in #24410 ships with automated tests (Given_InputPane.cs) that exercise the change.

    If you still see this behaviour on a build that includes that PR, please reopen or comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions