Fix for SafeArea management on iOS Failing test case - PointerGestureTest#30739
Closed
praveenkumarkarunanithi wants to merge 1 commit intodotnet:PureWeen/safe-area-fixes-ios-net10from
Closed
Conversation
Contributor
|
Hey there @@praveenkumarkarunanithi! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Member
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
Member
|
Closing for now as we work on alternatives |
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.
PR - #30629 Failing test case details :
Root Cause
The issue arises due to conflicting safe area handling between iOS's native
UIScrollViewbehavior and MAUI's safe area management for iOS. When the safe area changes (e.g., due to device rotation or UI updates), iOS automatically updates the content insets — for instance, adjusting from {0,0,0,0} to {44,0,34,0} on devices with a notch.This automatic adjustment triggers MAUI's layout invalidation. MAUI then re-measures and rearranges the layout to apply its own safe area logic, causing layout bounds to change. iOS detects this change and readjusts the insets again. This results in a feedback loop:
iOS adjusts insets → MAUI detects layout change → MAUI re-measures → layout bounds change → iOS adjusts insets again — leading to an infinite layout loop.
Description of Change
The fix disables iOS’s automatic content inset adjustments by setting
ContentInsetAdjustmentBehaviorto Never on iOS 11 and above. This ensures that only MAUI’s cross-platform safe area system handles inset logic, preventing conflicts and infinite layout loops. By allowing a single source of truth for safe area management, the fix provides stable and consistent layout behavior across platforms.Issues Fixed
Fixes #30629 failing test case - PointerGestureTest
Fix Reference
A similar approach can be seen in ShellTableViewController, where ContentInsetAdjustmentBehavior is set to avoid native inset interference.
Tested the behaviour in the following platforms
Output Video
Beforefix.mov
AfterFIX.mov