Skip to content

[inflight/candidate] Revert Android Shell safe area nav bar inset fixes - #35940

Merged
kubaflo merged 1 commit into
dotnet:inflight/candidatefrom
SyedAbdulAzeemSF4852:revert/pr-35555-35819
Jun 17, 2026
Merged

kubaflo merged 1 commit into
dotnet:inflight/candidatefrom
SyedAbdulAzeemSF4852:revert/pr-35555-35819

Conversation

@SyedAbdulAzeemSF4852

Copy link
Copy Markdown
Contributor

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

  • This PR reverts two chained Android safe area fixes that together introduced regressions on the inflight/candidate branch:

#35555 — Fix Android Shell top inset when nav bar is hidden

  • Fix Android Shell top inset when nav bar is hidden #35555 calls ViewCompat.RequestApplyInsets() synchronously inside ToolbarExtensions.UpdateIsVisible — before the layout pass runs. At that moment, GetLocationOnScreen returns the content view's stale pre-collapse position, which makes SafeAreaExtensions think 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 to y=0 with paddingTop=0 — rendering behind the status bar.

This timing issue caused 3 UI snapshot test failures:

  • ShellPages_NavBarVisibilityHide
  • VerifyNavBarStatusAtRuntime
  • ToggleHasNavigationBar_HidesBar_Visual

#35819 — Fix ShellPages_NavBarVisibilityHide, VerifyNavBarStatusAtRuntime, and ToggleHasNavigationBar_HidesBar_Visual test failures

  • [Android] Fix ShellPages_NavBarVisibilityHide, VerifyNavBarStatusAtRuntime, and ToggleHasNavigationBar_HidesBar_Visual test failures  #35819 attempted to fix the above 3 failures by caching the AppBar's visibility state as AppBarHasContent on MauiWindowInsetListener and using it as a guard in SafeAreaExtensions.cs — preserving top inset when the AppBar is confirmed hidden, and zeroing it when the AppBar is confirmed visible. This resolved the 3 test failures, but the AppBarHasContent != false guard 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:
  • EditorRuntimeTextAlignmentChanged
  • EditorPlaceholderRuntimeTextAlignmentChanged
  • VerifyLabelBackgroundIsClippedWithRectangleGeometry
  • TransparentShapeShouldNotDisplayShadow
  • TabBarShouldBeVisibleAfterNavigatingFromModalViaGoToAsync
  • VerifySwitchControlSize
  • CreateStackWithPadding
  • ModalNavigationShouldNotHang

Reason

Changes

From #35819 (MauiWindowInsetListener.cs, SafeAreaExtensions.cs):

  • Removed AppBarHasContent nullable bool property and SetAppBarContentState method
  • Removed SetAppBarContentState dispatch call from ApplyDefaultWindowInsets
  • Removed AppBarHasContent = null reset on navigation
  • Removed AppBarHasContent == true guard in the overlap branch of ApplyAdjustedSafeAreaInsetsPx
  • Removed AppBarHasContent != false guard in the below-safe branch of ApplyAdjustedSafeAreaInsetsPx

From #35555 (ToolbarExtensions.cs, MauiWindowInsetListener.cs, device tests):

  • Replaced HasVisibleAppBarContent() with the original simple inline MeasuredHeight > 0 check
  • Removed smart RequestApplyInsets chain (CoordinatorLayout → AppBarLayout → toolbar fallback);
    reverted to simple ViewCompat.RequestApplyInsets(nativeToolbar)
  • Removed device tests: HiddenShellNavigationBarClearsAppBarInsetPadding and
    PushingToPageWithoutNavigationBarClearsAppBarInsetPadding
  • Removed test helpers CreateTopCutoutInsets, AssertTopInsets, AttachCapturingWindowInsetsListener,
    and CapturingWindowInsetsListener

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jun 16, 2026
@dotnet-policy-service

Copy link
Copy Markdown
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.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 16, 2026
@github-actions github-actions Bot added area-safearea Issues/PRs that have to do with the SafeArea functionality platform/android labels Jun 16, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review June 17, 2026 10:56
@sheiksyedm
sheiksyedm requested a review from kubaflo June 17, 2026 10:56
@kubaflo
kubaflo merged commit 1352ed6 into dotnet:inflight/candidate Jun 17, 2026
27 of 41 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR9 milestone Jun 17, 2026
@PureWeen PureWeen mentioned this pull request Jul 7, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-safearea Issues/PRs that have to do with the SafeArea functionality community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants