[Android] Fix SafeAreaShouldWorkOnAllShellTabs test failure on API 36#34239
Open
praveenkumarkarunanithi wants to merge 4 commits intodotnet:mainfrom
Open
[Android] Fix SafeAreaShouldWorkOnAllShellTabs test failure on API 36#34239praveenkumarkarunanithi wants to merge 4 commits intodotnet:mainfrom
praveenkumarkarunanithi wants to merge 4 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34239Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34239" |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Root Cause
During Shell tab navigation animations, views move from off-screen into their final positions (for example,
viewLeft < 0during horizontal movement or elevated viewTop values during vertical movement). The existing logic appliedMath.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
viewIsAnimatingHorizontallyandviewIsAnimatingVerticallyfor clarity.Note
The test case
SafeAreaShouldWorkOnAllShellTabsalready 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
Output Video
Beforefix_36.mov
AfterFix_36.mov