Skip to content

[Android] Fix SafeAreaShouldWorkOnAllShellTabs test failure on API 36#34239

Open
praveenkumarkarunanithi wants to merge 4 commits intodotnet:mainfrom
praveenkumarkarunanithi:fix-33034-api36
Open

[Android] Fix SafeAreaShouldWorkOnAllShellTabs test failure on API 36#34239
praveenkumarkarunanithi wants to merge 4 commits intodotnet:mainfrom
praveenkumarkarunanithi:fix-33034-api36

Conversation

@praveenkumarkarunanithi
Copy link
Contributor

Root Cause

During Shell tab navigation animations, views move from off-screen into their final positions (for example, viewLeft < 0 during horizontal movement or elevated viewTop values during vertical movement). The existing logic applied Math.Max(0, position - margin) to account for margins, which clamped negative or small positive values to zero. This erased the signal used to detect that a view was still animating, causing the safe area logic to treat animating views as already settled. As a result, safe area padding was reduced too early during the final animation frames, leading to visible padding jumps.

Description of Change

To preserve correct animation detection, the animation state is now calculated using raw view position values before any margin clamping is applied, ensuring off-screen and in-transition states are not lost. The safe area calculation logic was also reordered so animation checks are evaluated before overlap checks for the left and right edges. This prevents partial padding from being applied when a view is near its final position but still animating. Finally, the animation flags were renamed to viewIsAnimatingHorizontally and viewIsAnimatingVertically for clarity.

Note

The test case SafeAreaShouldWorkOnAllShellTabs already exists on the main branch (Issue33034.cs). It was validated locally on an API 36 emulator to confirm the regression. Before the fix, the test failed due to incorrect safe area padding during Shell tab animations. After applying the fix, the test passes, confirming that safe area padding is correctly maintained throughout the animation cycle.

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output Video

Before Issue Fix After Issue Fix
Beforefix_36.mov
AfterFix_36.mov

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Feb 25, 2026
@NirmalKumarYuvaraj NirmalKumarYuvaraj added community ✨ Community Contribution area-safearea Issues/PRs that have to do with the SafeArea functionality platform/android labels Feb 25, 2026
@sheiksyedm sheiksyedm marked this pull request as ready for review February 26, 2026 11:38
Copilot AI review requested due to automatic review settings February 26, 2026 11:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Android safe-area padding instability during Shell tab transition animations (notably impacting the SafeAreaShouldWorkOnAllShellTabs UI test on API 36) by preserving raw view position signals used to detect in-progress animations.

Changes:

  • Computes horizontal/vertical “view is animating” state using raw on-screen coordinates before margin clamping occurs.
  • Reorders left/right edge logic to evaluate animation state before overlap-based partial inset reduction.
  • Renames animation flags for clarity (viewIsAnimatingHorizontally, viewIsAnimatingVertically).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34239

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34239"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

3 participants