Skip to content

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
praveenkumarkarunanithi:fix-PointerGestureTest
Closed

Fix for SafeArea management on iOS Failing test case - PointerGestureTest#30739
praveenkumarkarunanithi wants to merge 1 commit intodotnet:PureWeen/safe-area-fixes-ios-net10from
praveenkumarkarunanithi:fix-PointerGestureTest

Conversation

@praveenkumarkarunanithi
Copy link
Contributor

@praveenkumarkarunanithi praveenkumarkarunanithi commented Jul 21, 2025

PR - #30629 Failing test case details :

Root Cause

The issue arises due to conflicting safe area handling between iOS's native UIScrollView behavior 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 ContentInsetAdjustmentBehavior to 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

  • Android
  • Windows
  • iOS
  • Mac

Output Video

Before Issue Fix After Issue Fix
Beforefix.mov
AfterFIX.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 21, 2025
@dotnet-policy-service
Copy link
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.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 21, 2025
@praveenkumarkarunanithi praveenkumarkarunanithi changed the title fix updated. Fix for SafeArea management on iOS Failing test case - PointerGestureTest Jul 21, 2025
@praveenkumarkarunanithi praveenkumarkarunanithi marked this pull request as ready for review July 21, 2025 14:36
@praveenkumarkarunanithi praveenkumarkarunanithi requested a review from a team as a code owner July 21, 2025 14:36
@praveenkumarkarunanithi praveenkumarkarunanithi requested review from jsuarezruiz and rmarinho and removed request for a team July 21, 2025 14:36
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@PureWeen PureWeen closed this Jul 23, 2025
@PureWeen
Copy link
Member

Closing for now as we work on alternatives

@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants