Repository navigation
Conversation
Contributor
|
Hey there @@SyedAbdulAzeemSF4852! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
sheiksyedm
marked this pull request as ready for review
June 17, 2026 10:56
Merged
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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!
Issue Details
inflight/candidatebranch:#35555 — Fix Android Shell top inset when nav bar is hidden
ViewCompat.RequestApplyInsets()synchronously insideToolbarExtensions.UpdateIsVisible— before the layout pass runs. At that moment,GetLocationOnScreenreturns the content view's stale pre-collapse position, which makesSafeAreaExtensionsthink the view is already safely below the status bar and zeros the top inset. When the layout pass then runs and the AppBar collapses, the content moves toy=0withpaddingTop=0— rendering behind the status bar.This timing issue caused 3 UI snapshot test failures:
ShellPages_NavBarVisibilityHideVerifyNavBarStatusAtRuntimeToggleHasNavigationBar_HidesBar_Visual#35819 — Fix ShellPages_NavBarVisibilityHide, VerifyNavBarStatusAtRuntime, and ToggleHasNavigationBar_HidesBar_Visual test failures
AppBarHasContentonMauiWindowInsetListenerand using it as a guard inSafeAreaExtensions.cs— preservingtopinset when the AppBar is confirmed hidden, and zeroing it when the AppBar is confirmed visible. This resolved the 3 test failures, but theAppBarHasContent != falseguard is too broad: it fires for all views on any page where the AppBar is hidden, not just the stale Shell root content view it was designed to protect. This introduced 8 new Android UI snapshot regressions:EditorRuntimeTextAlignmentChangedEditorPlaceholderRuntimeTextAlignmentChangedVerifyLabelBackgroundIsClippedWithRectangleGeometryTransparentShapeShouldNotDisplayShadowTabBarShouldBeVisibleAfterNavigatingFromModalViaGoToAsyncVerifySwitchControlSizeCreateStackWithPaddingModalNavigationShouldNotHangReason
RequestApplyInsets()dispatch and the layout pass. Fix Android Shell top inset when nav bar is hidden #35555 introduced the race; [Android] Fix ShellPages_NavBarVisibilityHide, VerifyNavBarStatusAtRuntime, and ToggleHasNavigationBar_HidesBar_Visual test failures #35819 attempted to work around it via anAppBarHasContentstate cache, but the guard scope is too wide — it appliespaddingTop=statusBarHeightto unrelated child views (e.g., centeredStackLayout,Editor, overlays) that happen to be visible when the AppBar is hidden, producing incorrect offsets across a wide range of layout scenarios.Changes
From #35819 (
MauiWindowInsetListener.cs,SafeAreaExtensions.cs):AppBarHasContentnullable bool property andSetAppBarContentStatemethodSetAppBarContentStatedispatch call fromApplyDefaultWindowInsetsAppBarHasContent = nullreset on navigationAppBarHasContent == trueguard in theoverlapbranch ofApplyAdjustedSafeAreaInsetsPxAppBarHasContent != falseguard in thebelow-safebranch ofApplyAdjustedSafeAreaInsetsPxFrom #35555 (
ToolbarExtensions.cs,MauiWindowInsetListener.cs, device tests):HasVisibleAppBarContent()with the original simple inlineMeasuredHeight > 0checkRequestApplyInsetschain (CoordinatorLayout → AppBarLayout → toolbar fallback);reverted to simple
ViewCompat.RequestApplyInsets(nativeToolbar)HiddenShellNavigationBarClearsAppBarInsetPaddingandPushingToPageWithoutNavigationBarClearsAppBarInsetPaddingCreateTopCutoutInsets,AssertTopInsets,AttachCapturingWindowInsetsListener,and
CapturingWindowInsetsListener