-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix for Shell tab visibility not updating when navigating back multiple pages #34403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2f22928
[ci] Auto-trigger uitests and device-tests on darc-* branches (#34317)
PureWeen 2c6474f
Add PublicAPI.Unshipped.txt BOM sort warning to Copilot instructions …
jfversluis 3e2acb4
[Android] Fix crash in GraphicsView when using TapGestureRecognizer (…
jpd21122012 538463e
[Android] Fix Label with MaxLines truncating text in horizontal Scrol…
Vignesh-SF3580 e8265c0
Add Android NativeAOT integration tests (#33756)
sbomer 6c123d7
[iOS] Fix SafeArea infinite layout cycle with parent hierarchy walk a…
PureWeen fb538bf
Fix-33351-Made changes to trigger page appearing events before platfo…
BagavathiPerumal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| applyTo: | ||
| - "**/Platform/iOS/MauiView.cs" | ||
| - "**/Platform/iOS/MauiScrollView.cs" | ||
| - "**/Platform/iOS/*SafeArea*" | ||
| --- | ||
|
|
||
| # Safe Area Guidelines (iOS/macCatalyst) | ||
|
|
||
| ## Platform Differences | ||
|
|
||
| | | macOS 14/15 | macOS 26+ | | ||
| |-|-------------|-----------| | ||
| | Title bar inset | ~28px | ~0px | | ||
| | Used in CI | ✅ | ❌ | | ||
|
|
||
| Local macOS 26+ testing does NOT validate CI behavior. Fixes must pass CI on macOS 14/15. | ||
|
|
||
| | Platform | `UseSafeArea` default | | ||
| |----------|-----------------------| | ||
| | iOS | `false` | | ||
| | macCatalyst | `true` | | ||
|
|
||
| ## Architecture (PR #34024) | ||
|
|
||
| **`IsParentHandlingSafeArea`** — before applying adjustments, `MauiView`/`MauiScrollView` walk ancestors to check if any ancestor handles the **same edges**. If so, descendant skips (avoids double-padding). Edge-aware: parent handling `Top` does not block child handling `Bottom`. Result cached in `bool? _parentHandlesSafeArea`; cleared on `SafeAreaInsetsDidChange`, `InvalidateSafeArea`, `MovedToWindow`. `AppliesSafeAreaAdjustments` is `internal` for cross-type ancestor checks. | ||
|
|
||
| **`EqualsAtPixelLevel`** — safe area compared at device-pixel resolution to absorb sub-pixel animation noise (`0.0000001pt` during `TranslateToAsync`), preventing oscillation loops (#32586, #33934). | ||
|
|
||
| ## Anti-Patterns | ||
|
|
||
| **❌ Window Guard** — comparing `Window.SafeAreaInsets` to filter callbacks blocks legitimate updates. On macCatalyst + custom TitleBar, `WindowViewController` pushes content down, changing the **view's** `SafeAreaInsets` without changing the **window's**. Caused 28px CI shift (macOS 14/15 only). Never gate per-view callbacks on window-level insets. | ||
|
|
||
| **❌ Semantic mismatch** — `_safeArea` is filtered by `GetSafeAreaForEdge` (zeroes edges per `SafeAreaRegions`); raw `UIView.SafeAreaInsets` includes all edges. Never compare them — compare raw-to-raw or adjusted-to-adjusted. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ trigger: | |
| - release/* | ||
| - net*.0 | ||
| - inflight/* | ||
| - darc-* | ||
| tags: | ||
| include: | ||
| - '*' | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ trigger: | |
| - release/* | ||
| - net*.0 | ||
| - inflight/* | ||
| - darc-* | ||
| tags: | ||
| include: | ||
| - '*' | ||
|
|
||
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
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
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
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
Binary file added
BIN
+296 KB
...sts/TestCases.Android.Tests/snapshots/android/LabelNotTruncatedWithMaxLines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31 KB
...es.Android.Tests/snapshots/android/TabBarVisibilityAfterMultiLevelPopToRoot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions
84
src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ParentChildTest.xaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue28986_ParentChildTest" | ||
| Title="Issue28986 - Parent Child SafeArea"> | ||
|
|
||
| <Grid x:Name="ParentGrid" | ||
| BackgroundColor="#FFEB3B" | ||
| SafeAreaEdges="None,Container,None,None" | ||
| AutomationId="ParentGrid"> | ||
|
|
||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="Auto"/> | ||
| <RowDefinition Height="*"/> | ||
| <RowDefinition Height="Auto"/> | ||
| </Grid.RowDefinitions> | ||
|
|
||
| <!-- Top Indicator --> | ||
| <Label Grid.Row="0" | ||
| Text="↑ Parent handles TOP safe area ↑" | ||
| BackgroundColor="#FF5722" | ||
| TextColor="White" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="TopIndicator"/> | ||
|
|
||
| <!-- Middle Content Area --> | ||
| <VerticalStackLayout Grid.Row="1" | ||
| BackgroundColor="#00BCD4" | ||
| VerticalOptions="Center" | ||
| Spacing="20" | ||
| Padding="20"> | ||
|
|
||
| <Label Text="SafeAreaEdges Independent Handling Demo" | ||
| FontSize="20" | ||
| FontAttributes="Bold" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="TitleLabel"/> | ||
|
|
||
| <Label x:Name="StatusLabel" | ||
| Text="Parent: Top=Container, Bottom=None | Child: Bottom=Container" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="StatusLabel"/> | ||
|
|
||
| <Button Text="Toggle Parent Top SafeArea" | ||
| Clicked="OnToggleParentTop" | ||
| HorizontalOptions="Center" | ||
| AutomationId="ToggleParentTopButton"/> | ||
|
|
||
| <Button Text="Toggle Parent Bottom SafeArea" | ||
| Clicked="OnToggleParentBottom" | ||
| HorizontalOptions="Center" | ||
| AutomationId="ToggleParentBottomButton"/> | ||
|
|
||
| <Button Text="Toggle Child Bottom SafeArea" | ||
| Clicked="OnToggleChildBottom" | ||
| HorizontalOptions="Center" | ||
| AutomationId="ToggleChildBottomButton"/> | ||
|
|
||
| <Label Text="Expected behavior:" | ||
| FontAttributes="Bold" | ||
| Margin="0,20,0,0" | ||
| AutomationId="ExpectedLabel"/> | ||
|
|
||
| <Label Text="• Top indicator stays below notch/status bar (parent handles top)
• Bottom indicator stays above home indicator (child handles bottom)
• Both work INDEPENDENTLY - no conflict!
• Runtime changes to parent do NOT disrupt child's handling
• NO DOUBLE PADDING when both parent and child handle same edge" | ||
| FontSize="12" | ||
| AutomationId="ExpectedDetailsLabel"/> | ||
|
|
||
| </VerticalStackLayout> | ||
|
|
||
| <!-- Bottom Indicator --> | ||
| <Grid Grid.Row="2" | ||
| BackgroundColor="#9C27B0" | ||
| x:Name="ChildGrid" | ||
| SafeAreaEdges="None,None,None,Container" | ||
| AutomationId="ChildGrid"> | ||
|
|
||
| <Label Text="↓ Child handles BOTTOM safe area ↓" | ||
| BackgroundColor="#8BC34A" | ||
| HorizontalTextAlignment="Center" | ||
| AutomationId="BottomIndicator"/> | ||
|
|
||
| </Grid> | ||
| </Grid> | ||
| </ContentPage> |
59 changes: 59 additions & 0 deletions
59
src/Controls/tests/TestCases.HostApp/Issues/Issue28986_ParentChildTest.xaml.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 28986, "SafeAreaEdges independent handling for parent and child controls", PlatformAffected.iOS, issueTestNumber: 9)] | ||
| public partial class Issue28986_ParentChildTest : ContentPage | ||
| { | ||
| bool _parentTopEnabled = true; | ||
| bool _parentBottomEnabled = false; | ||
| bool _childBottomEnabled = true; | ||
|
|
||
| public Issue28986_ParentChildTest() | ||
| { | ||
| InitializeComponent(); | ||
| UpdateParentGridSafeAreaEdges(); | ||
| UpdateStatusLabel(); | ||
| } | ||
|
|
||
| void OnToggleParentTop(object sender, EventArgs e) | ||
| { | ||
| _parentTopEnabled = !_parentTopEnabled; | ||
| UpdateParentGridSafeAreaEdges(); | ||
| UpdateStatusLabel(); | ||
| } | ||
|
|
||
| void OnToggleParentBottom(object sender, EventArgs e) | ||
| { | ||
| _parentBottomEnabled = !_parentBottomEnabled; | ||
| UpdateParentGridSafeAreaEdges(); | ||
| UpdateStatusLabel(); | ||
| } | ||
|
|
||
| void OnToggleChildBottom(object sender, EventArgs e) | ||
| { | ||
| _childBottomEnabled = !_childBottomEnabled; | ||
|
|
||
| // Toggle between Bottom=Container and Bottom=None | ||
| ChildGrid.SafeAreaEdges = _childBottomEnabled | ||
| ? new SafeAreaEdges(SafeAreaRegions.None, SafeAreaRegions.None, SafeAreaRegions.None, SafeAreaRegions.Container) | ||
| : new SafeAreaEdges(SafeAreaRegions.None); | ||
|
|
||
| UpdateStatusLabel(); | ||
| } | ||
|
|
||
| void UpdateParentGridSafeAreaEdges() | ||
| { | ||
| // Build parent grid SafeAreaEdges based on top and bottom flags | ||
| SafeAreaRegions top = _parentTopEnabled ? SafeAreaRegions.Container : SafeAreaRegions.None; | ||
| SafeAreaRegions bottom = _parentBottomEnabled ? SafeAreaRegions.Container : SafeAreaRegions.None; | ||
|
|
||
| ParentGrid.SafeAreaEdges = new SafeAreaEdges(SafeAreaRegions.None, top, SafeAreaRegions.None, bottom); | ||
| } | ||
|
|
||
| void UpdateStatusLabel() | ||
| { | ||
| var parentTop = _parentTopEnabled ? "Container" : "None"; | ||
| var parentBottom = _parentBottomEnabled ? "Container" : "None"; | ||
| var childBottom = _childBottomEnabled ? "Container" : "None"; | ||
| StatusLabel.Text = $"Parent: Top={parentTop}, Bottom={parentBottom} | Child: Bottom={childBottom}"; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.