Repository navigation
[release/10.0.1xx-sr10] Fix per-edge iOS safe area handling - #37728
Conversation
Manual backport of dotnet#37033 for .NET MAUI 10.0.101. Source head: 7b2bdbb Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1e7f77e3-4862-4b92-a662-d12b5918bb59
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37728Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37728" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR backports the per-edge iOS safe area ancestor-blocking fix (from #37033) into release/10.0.1xx-sr10 to address #34563, ensuring parent safe-area handling only suppresses descendant padding on the same edge rather than all edges.
Changes:
- Add a shared iOS helper (
ResolveParentBlockedEdges) to compute and cache per-edge ancestor blocking. - Update
MauiViewandMauiScrollViewiOS safe-area computation to apply blocking per-edge and invalidate the new cache on the same lifecycle events as before. - Add a new UI test + HostApp repro page for issue #34563.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Core/src/Platform/iOS/SafeAreaPadding.cs | Adds per-edge ancestor walk + caching helper to decide which edges are blocked by parents. |
| src/Core/src/Platform/iOS/MauiView.cs | Switches safe-area logic to per-edge blocking and updates cache invalidation points. |
| src/Core/src/Platform/iOS/MauiScrollView.cs | Applies the same per-edge blocking approach to scroll view inset calculation and caching. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34563.cs | Adds a UI test validating per-edge safe-area behavior for the reported regression. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue34563.cs | Adds the HostApp reproduction page used by the UI test. |
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review
@* Issue34563 gives SafeAreaEdges to empty ContentView instances, but safe-area adjustment insets a view instead of repositioning the view itself. The assertions only require the top box's absolute screen Y to be positive and the bottom box to remain within its grid; both conditions can pass on the pre-fix whole-view suppression path (and behind the navigation bar) without exercising the intended top/bottom edge mismatch.
Make the test measure an automation-id'd child inside a safe-area-aware container relative to that container/root grid, following the existing safe-area issue-test pattern. It should distinguish the single applicable edge inset from both no inset and double padding.
Methodology: 3 independent reviewers with adversarial consensus + repo domain specialist. One actionable finding; no production-code defect reached consensus. The existing bot overview was not counted as an independent reviewer.
Measure a nested marker through no-, single-, and shared-edge states so the regression catches cross-edge suppression and double padding. Ignore sub-pixel ancestor insets when resolving blocked edges.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@PureWeen addressed in 2efca92. The Issue34563 page now puts an automation-ID marker inside nested safe-area-aware containers and toggles three measured states relative to a stable root: child-only Top (one inset), neither Top (no inset), and parent+child Top (still one inset, not double padding). The iOS HostApp and Appium assembly build cleanly, and Core iOS |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Core/src/Platform/iOS/MauiScrollView.cs:138
GetSafeAreaComponentForEdgeinMauiScrollViewappears to be dead code (no references in the iOS platform layer). Keeping an unused helper + docstring here makes the safe-area arbitration logic harder to follow and maintain.
Consider removing it until there is a concrete call site that needs it.
/// <summary>
/// Returns this scroll view's own, already-resolved safe area component for the given edge
/// (Left=0, Top=1, Right=2, Bottom=3), used by descendants (or, in principle, callers)
/// to determine whether this view has a real, non-zero inset for a specific edge.
/// </summary>
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review
💡 Testing — The regression test is compiled only for IOS, although the changed Platform/iOS implementation is also compiled by the MacCatalyst target. The Mac test project defines MACCATALYST rather than IOS, so a MacCatalyst title-bar/top-inset regression could ship without this guard running. Cover the same scenario under #if IOS || MACCATALYST, or document and separately cover a concrete MacCatalyst limitation.
Flagged by: 2/3 independent reviewers.
Methodology: Each independent reviewer assessed the exact PR snapshot; findings were retained only after adversarial consensus plus MAUI domain-specialist validation. No production-code defect reached consensus. The prior regression-test feedback is addressed by the marker and state-transition assertions in this revision.
Compile and classify the nested per-edge safe-area scenario for both Apple targets so MacCatalyst receives the same guard as iOS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@PureWeen addressed the MacCatalyst coverage gap in 77859ce: Issue34563 now compiles for |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Core/src/Platform/iOS/MauiScrollView.cs:138
- The XML doc for GetSafeAreaComponentForEdge says it’s “used by descendants (or, in principle, callers)”, but the method is currently private and (in this PR) not referenced anywhere. This is misleading documentation and suggests an API surface that doesn’t exist.
/// <summary>
/// Returns this scroll view's own, already-resolved safe area component for the given edge
/// (Left=0, Top=1, Right=2, Bottom=3), used by descendants (or, in principle, callers)
/// to determine whether this view has a real, non-zero inset for a specific edge.
/// </summary>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/Core/src/Platform/iOS/MauiScrollView.cs:139
GetSafeAreaComponentForEdgeis currently private and has no call sites, but its XML doc claims it’s used by descendants/callers. Either remove this unused helper to reduce confusion, or make it part of a real contract and consume it from the safe-area ancestor arbitration logic.
/// <summary>
/// Returns this scroll view's own, already-resolved safe area component for the given edge
/// (Left=0, Top=1, Right=2, Bottom=3), used by descendants (or, in principle, callers)
/// to determine whether this view has a real, non-zero inset for a specific edge.
/// </summary>
double GetSafeAreaComponentForEdge(int edge) => edge switch
| public Issue34563(TestDevice device) : base(device) { } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.SafeAreaEdges)] | ||
| public void SafeAreaEdgesRespectedWhenTopAndBottomMismatch() | ||
| { | ||
| const string initialStatus = "Parent: Top=None, Bottom=Container | Child: Top=Container"; | ||
| App.WaitForElement("TopMarker"); | ||
| Assert.That(App.WaitForTextToBePresentInElement("SafeAreaStatusLabel", initialStatus), Is.True); | ||
|
|
||
| var rootTop = App.WaitForElement("RootGrid").GetRect().Y; | ||
| var singleTopInset = App.WaitForElement("TopMarker").GetRect().Y - rootTop; | ||
| #if MACCATALYST | ||
| if (singleTopInset <= 5) | ||
| Assert.Ignore("This MacCatalyst environment does not expose a measurable title-bar safe area."); | ||
| #endif | ||
| Assert.That(singleTopInset, Is.GreaterThan(5), | ||
| "The child must apply the top safe area even though its parent handles only Bottom."); |
There was a problem hiding this comment.
I’m keeping this guard inline. It is a four-line compile-time check tied directly to the just-computed inset, so moving it behind a helper would add indirection without making the test platform-agnostic. The UI-test guidance does not require such a helper, and this test suite already uses direct #if MACCATALYST blocks inside test methods (for example Issue32791 and Bugzilla60122). The current placement makes the MacCatalyst-only observability exception explicit while leaving all iOS assertions unchanged.
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review
❌ Regression Prevention — The new scenario cannot distinguish this per-edge fix from the pre-fix whole-view suppression: the child requests only Top, while the parent initially requests only Bottom. Both implementations apply the child Top inset in that state; the later shared-Top state also yields one inset in both. Add a state where the child requests two edges and the parent handles exactly one, then assert the child still applies the unblocked edge.
Flagged by: 2/3 independent reviewers after dispute.
SafeAreaEdges. MapSafeAreaEdges invalidates only the changed view and its ancestors, while a descendant with an already-valid cache can keep treating the newly handled edge as unblocked. Invalidate descendant blocked-edge caches when an ancestor safe-area state changes, or use an ancestor state/version mechanism.
Flagged by: 2/3 independent reviewers after dispute.
Test coverage: A new Apple UI test exists, but it needs the discriminating mixed-edge state above to guard the regression.
Prior review status: Existing feedback about the MacCatalyst minimum-inset threshold was not duplicated.
Methodology: 3 independent reviewers with adversarial consensus + repo domain specialist.
Invalidate iOS safe-area state throughout the native subtree when an ancestor changes its edge policy, and strengthen the mixed-edge regression coverage with opposite parent-edge transitions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@PureWeen Addressed both findings in
The Core device-test app builds cleanly for iOS and MacCatalyst, and the targeted Ready for re-review. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
src/Core/src/Platform/iOS/MauiView.cs:268
GetSafeAreaForEdgesuppresses the edge entirely whenisEdgeBlockedByParentis true. That can unintentionally suppress a descendant’sSafeAreaRegions.SoftInput(keyboard avoidance) when an ancestor only handles the same edge forContainersafe-area padding (e.g., home indicator). SoftInput is already coordinated viaIsSoftInputHandledByParent, so a Container-handling ancestor shouldn’t block a SoftInput-only descendant edge.
// If an ancestor already applies a real, non-zero safe area inset for this exact edge,
// defer to it and don't double-apply here. This is what prevents double-padding when a
// parent and child both handle the same edge (#33595, #32586). Edges are checked
// independently, so a parent handling only Top never blocks a child that handles Bottom (#28986).
if (isEdgeBlockedByParent)
{
return 0;
}
src/Core/src/Platform/iOS/MauiScrollView.cs:296
GetManualInsetForEdgereturns 0 for any edge blocked by a parent, which can also suppressSafeAreaRegions.SoftInputbehavior when the parent is only handling Container safe-area padding. SoftInput keyboard avoidance should not be blocked by Container-only ancestor handling; SoftInput coordination is handled separately viaIsSoftInputHandledByParentinMauiView.
// If an ancestor already applies a real, non-zero safe area inset for this exact
// edge, defer to it and don't double-apply here (#33595, #32586). Edges are checked
// independently, so a parent handling only Top never blocks this scroll view from
// independently handling Bottom (#28986, #34563).
if (isEdgeBlockedByParent)
return 0;
return safeAreaInset;
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review
No actionable issues found at aed942277dafe1e6910b609550120a21852ccada.
Methodology: 3 independent reviewers with adversarial consensus + repo domain specialist.
SR10.1 merge assessmentRecommendation: merge only after a successful rerun or an explicit release-owner waiver. Current head The two underlying job failures are infrastructure-only: Windows Debug and Windows Release both failed while downloading the external GtkSharp dependency after the 100-second HTTP timeout. No code-correlated failure was found, but the red required checks still need a rerun/waiver and approval from a maintainer other than the PR author. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1e7f77e3-4862-4b92-a662-d12b5918bb59
…load (#37746) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- release-readiness-agent: human-approval-required --> ## Summary Integrates the staged **.NET MAUI 10.0.101 (SR10.1)** payload from `inflight/10.0.101` into `release/10.0.1xx-sr10`, based on the shipped `10.0.100` release. The full release inventory and servicing decisions are tracked in #37723. The [authoritative regression query](https://github.com/dotnet/maui/issues?q=repo%3Adotnet%2Fmaui%20is%3Aissue%20is%3Aopen%20%28label%3A%22regressed-in-10.0.10%22%20OR%20label%3A%22regressed-in-10.0.20%22%20OR%20label%3A%22regressed-in-10.0.30%22%20OR%20label%3A%22regressed-in-10.0.40%22%20OR%20label%3A%22regressed-in-10.0.50%22%20OR%20label%3A%22regressed-in-10.0.60%22%20OR%20label%3A%22regressed-in-10.0.70%22%20OR%20label%3A%22regressed-in-10.0.80%22%20OR%20label%3A%22regressed-in-10.0.90%22%20OR%20label%3A%22regressed-in-10.0.100%22%29) remains the source for the servicing-regression scope. > [!IMPORTANT] > Checked items under **Staged in this PR** are merged into `inflight/10.0.101`, not yet into `release/10.0.1xx-sr10`. They reach the release branch only when this aggregate PR is merged. ## Status at a glance - [x] Stage the selected regression backports independently on `inflight/10.0.101`. - [x] Stage the SkiaSharp 4.150.1 payload and selective `SKPath.AddCircle` compatibility fix. - [x] Stage the isolated iOS 26 Liquid Glass TabBar payload from #37542. - [ ] Complete or explicitly defer the six unresolved servicing regressions listed below. - [ ] Complete the release gates and merge this PR into `release/10.0.1xx-sr10`. ## Staged in this PR ### Servicing regressions - [x] #35826 — Android MediaPicker completion from child activities. Source #35944; component backport #37724. - [x] #36298 — Windows dynamic `ContentPresenter` assignment. Source #36430; component backport #37725. - [x] #36749 — preserve custom iOS Button styling. Source #36769; component backport #37726. - [x] #36736 — align Android SwipeItem content. Source #36820; component backport #37727. - [x] #34563 — per-edge iOS safe-area handling. Source #37033; component backport #37728. - [x] #37706 — Android root-page back handling. Source #37709; component backport #37729. - [x] #37705 — Android Material 3 status-bar contrast. Source #37710; component backport #37730. - [x] #37423 — restore native iOS 26 Liquid Glass TabBar behavior through the isolated four-file payload from merged PR #37542. - [x] #37418 — Android off-screen `TranslationY` layout padding. Source fix #37772; focused backport commit `10799e67df`. - [x] #37361 — iOS RefreshView pull-to-refresh with an empty CollectionView. Source fix #37404; focused backport commit `d26faa8e93`. - [x] #37638 — Android `Screenshot.CaptureAsync` synchronous UI-thread deadlock. Source fix #37680; focused backport commit `778040a233`. ### Planned Skia payload - [x] Port the Skia/Svg.Skia update from #36255 through component backport #37731. - [x] Include only the required `SKPath.AddCircle` compatibility change from #36787; exclude its unrelated SourceGen changes. - [x] Confirm a matching SkiaSharp 4.150.1 native-assets/PDB build for `_SkiaSharpNativeAssetsVersion`, or record an explicit release-owner waiver. ### Integration follow-ups - [x] Apply the aggregate review fixes for safe-area cache invalidation, Activity-for-result cancellation ownership, and Android theme-test semantics. - [x] Keep the final branch payload as focused release commits without unrelated `inflight/current` history. - [x] Validate the #37418 and #37638 focused Android UI tests on the aggregate branch (2/2 passed). - [ ] Validate the #37361 focused iOS UI test on the aggregate branch. ## Already present on the SR10 base — no new merge needed - [x] #36852 — Android Shell hidden-fragment leak; fix #36903 is already in SR10. - [x] #36735 — Android ActivityIndicator visibility; fix #36748 is already in SR10. - [x] #36853 — Android Shell DI-singleton route blank page; fix #36903 is already in SR10. - [x] #36942 — Android UI event handling; fix #36988 is already in SR10. - [x] #37281 — Android scrolling inside shadowed containers; backport #37312 is already in SR10. ## Completed disposition — no backport required - [x] #37700 — closed as intended SR10 `SwipeView.Threshold` behavior from #36878; any SwipeItem sizing concern should be tracked separately. ## Not included yet — merge, defer, or explicitly disposition before payload freeze - [ ] #35301 — Windows CollectionView applies WinUI styling by default; no linked fix PR. - [ ] #34491 — Android CollectionView selection with `PointerGestureRecognizer`; replacement fix #37952 remains draft against `main`. - [ ] #35059 — iOS app becomes unresponsive when opening a ComboBox dropdown in landscape; no linked fix PR. - [ ] #37407 — iOS TimePicker default `t` format forces en-US; fix #37797 remains draft against `main`. - [ ] #36269 — Android `SafeAreaEdges` with Shell tab navigation and hidden TabBar; source fix #36474 remains open against `main` and has no SR10 backport. - [ ] #37657 — Android Shell/root-page `OnBackButtonPressed()` in Release builds; no linked fix PR. ## Release completion ### Before merging this PR - [ ] Refresh the authoritative query and reconcile #37723 with its current results. - [ ] Record an include/defer/close decision for every unresolved regression above. - [ ] Validate every included regression on its reported OS/version using the `10.0.101` candidate packages. - [ ] Complete current-head aggregate CI and resolve or explicitly waive every required build/device/UI-test failure. - [ ] Resolve or waive the Skia native-assets/PDB release gate. - [ ] Bump `eng/Versions.props` from patch `100` to `101` after the payload is frozen. - [ ] Obtain the required independent current-head maintainer approvals. - [ ] Merge #37746 into `release/10.0.1xx-sr10`. ### After merge - [ ] Confirm BAR promotion and the per-build validation feed used by the ship assessment. - [ ] Publish and tag `10.0.101`. - [ ] Complete the Visual Studio insertion/default-MAUI-version update. ## Notes - No automated `/backport` command was used for this release payload. - Supersedes #37745, which GitHub automatically closed when the integration branch was renamed from `vs/10.0.101` to `inflight/10.0.101`.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Summary
Manual backport of #37033 to
release/10.0.1xx-sr10for .NET MAUI 10.0.101.SafeAreEdgeisn't respected whenTopandBottomconstraints mismatch #34563.7b2bdbbf6a03b5481d0aa1e4d7b1a989afd98786.inflight/currentand has not flowed tomain; this manual port intentionally excludes unrelated inflight branch history.Validation
9ccc72faab8add1aa47434397018498d7e3f115a.Core.csprojbuilds successfully fornet10.0-ios26.0in Release configuration with zero warnings and zero errors.Review gate
This agent-authored release PR must remain unmerged until two distinct non-bot MAUI maintainers with write access, other than the PR author, approve the current head SHA.