Repository navigation
fix(safearea): claim the input pane occlusion that SoftInput handles - #1679
Conversation
A SoftInput SafeArea pads the focused element above the input pane, but the framework didn't know it, and also scrolled the root content above the pane. SafeArea then measured its content shifted into the window insets, and the two adjustments never settled: typing in a TextBox at the bottom of the page threw a LayoutCycleException on Android (unoplatform/uno#25529). Set EnsuredFocusedElementInView when the focused element is within a SoftInput SafeArea, and bring it into view within the inner scrollers once the padding is laid out, as the framework would have. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1679.eastus2.azurestaticapps.net |
|
@Mergifyio backport servicing/10.0 |
✅ Backports have been createdDetails
Cherry-pick of 6496c40 has failed: 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 |
The insets are computed from transformed bounds, in float precision, and applied from LayoutUpdated whenever they differ from the current ones. A fractional offset of the content can then make them differ by a float ulp on every pass, and the layout never settles. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
23b88ad to
6496c40
Compare
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1679.eastus2.azurestaticapps.net |
1 similar comment
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1679.eastus2.azurestaticapps.net |
|
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. |
- SafeArea.cs: drop the conflict markers the cherry-pick of the pixel-snapping commit left in; keep SnapToPhysicalPixels and servicing's OnInsetsApplied(FrameworkElement owner, ...) signature, which ApplyInsets already calls. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-1679 fix(safearea): claim the input pane occlusion that SoftInput handles (backport #1679)
Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Xiaotian Gu <[email protected]>
GitHub Issue (If applicable): closes unoplatform/uno#25529
PR Type
What is the current behavior?
On Android, typing the first character with the soft keyboard into a TextBox at the bottom of a page throws a
LayoutCycleExceptionwhen the page uses SafeArea the usual way:VisibleBoundsinMarginmode on the root, andSoftInputon the content above the keyboard. It regressed with the input pane root viewport in Uno (unoplatform/uno#24947, backported in unoplatform/uno#25032).Both sides handle the same keyboard occlusion:
SoftInputSafeArea pads the focused TextBox above the keyboard.VisibleBoundsSafeArea measures its element shifted into the navigation bar inset (TransformToVisual(null)includes the shift), and reduces its bottom margin. That value comes from float32 transforms, andApplyInsetscompares exactly, so every layout pass applies a margin one float ulp off the previous one, and the layout never settles.TextBoxViewcallsUpdateLayout()on each text change, so the first keystroke hits the layout cycle limit.Even without the crash, the shift pushes the top of the page under the status bar while the keyboard is up.
What is the new behavior?
InputPaneVisibilityEventArgs.EnsuredFocusedElementInViewfrom its existingShowing/Hidinghandler (theInputPanereads the flag after raising them), so Uno doesn't also shift the root. Since that flag also skips Uno's bring-into-view of the focused element, which inner scrollers still need, SafeArea makes the same request (with the 20px margin) once its padding is laid out. Focused elements outside any SoftInput SafeArea (e.g. in a flyout) are left to Uno, as before.XamlRoot.RasterizationScale) before they are compared and applied, so sub-pixel noise from transformed bounds can no longer relayout on every pass.PR Checklist
Please check if your PR fulfills the following requirements:
Other information
Testing
Desktop (Windows, Skia): the
SafeAreaTestsruntime tests pass, including the new ones (claiming only for a focused descendant of a SoftInput SafeArea, the issue's drifting margin values being applied once, and the pixel snapping).Android (Pixel 8, Gboard, Skia renderer): the same two commits, cherry-picked onto
servicing/10.0(10.0.0-dev.7) and used through a package override on Uno.Sdk 6.8.0-dev.66, compared with the stock 10.0.0-dev.7:It wasn't run on Uno 7 itself; the change has the same effect there, as the root viewport is the same on master.
Not covered: iOS and WebAssembly, where the same root viewport shift and SafeArea code exist (the issue couldn't make it loop there).
Backport:
servicing/10.0needs a small conflict resolution in the snapping commit, asOnInsetsAppliedtakes the owner there.Separately (Uno, not addressed here): a TextBox in a flyout anchored near the bottom of the page stays behind the keyboard on 6.8.0-dev.66, with or without this change: the root viewport only brings the page content into view, not the popups.
🤖 Generated with Claude Code