Repository navigation
fix(safearea): claim the input pane occlusion that SoftInput handles (backport #1679) - #1680
Merged
Merged
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]> (cherry picked from commit ad25543)
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]> (cherry picked from commit 6496c40) # Conflicts: # src/Uno.Toolkit.UI/Controls/SafeArea/SafeArea.cs
Contributor
Author
|
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 |
7 of 21 tasks
Closed
1 task done
Merged
7 of 18 tasks
- 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]>
kazo0
approved these changes
Oct 28, 2026
Contributor
Author
|
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. |
Merged
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
This is an automatic backport of pull request #1679 done by [Mergify](https://mergify.com).