Fix for SafeArea management on iOS Failing test case - LabelShouldSizeProperlyOnCollectionView#30682
Merged
PureWeen merged 8 commits intodotnet:PureWeen/safe-area-fixes-ios-net10from Jul 17, 2025
Conversation
* Fixed the SafeArea test case issues and 22417(mac) main issue * Removed the Fails condition on Mac
…and improve RTL layout handling
…om/dotnet/maui into PureWeen/safe-area-fixes-ios-net10
f43e5cc
into
dotnet:PureWeen/safe-area-fixes-ios-net10
1 check passed
PureWeen
added a commit
that referenced
this pull request
Jul 17, 2025
…eProperlyOnCollectionView (#30682) * Fix SafeArea management on iOS * Fixed the SafeArea branch test case failures issues (#30622) * Fixed the SafeArea test case issues and 22417(mac) main issue * Removed the Fails condition on Mac * Enhance CrossPlatformArrange method to support safe area adjustments and improve RTL layout handling * - add images and fix naming * - additional image updates * - add comments * fix update. --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com> Co-authored-by: Ahamed-Ali <102580874+Ahamed-Ali@users.noreply.github.com>
PureWeen
added a commit
that referenced
this pull request
Jul 17, 2025
…eProperlyOnCollectionView (#30682) * Fix SafeArea management on iOS * Fixed the SafeArea branch test case failures issues (#30622) * Fixed the SafeArea test case issues and 22417(mac) main issue * Removed the Fails condition on Mac * Enhance CrossPlatformArrange method to support safe area adjustments and improve RTL layout handling * - add images and fix naming * - additional image updates * - add comments * fix update. --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com> Co-authored-by: Ahamed-Ali <102580874+Ahamed-Ali@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this pull request
Jul 18, 2025
…eProperlyOnCollectionView (#30682) * Fix SafeArea management on iOS * Fixed the SafeArea branch test case failures issues (#30622) * Fixed the SafeArea test case issues and 22417(mac) main issue * Removed the Fails condition on Mac * Enhance CrossPlatformArrange method to support safe area adjustments and improve RTL layout handling * - add images and fix naming * - additional image updates * - add comments * fix update. --------- Co-authored-by: Shane Neuville <shneuvil@microsoft.com> Co-authored-by: Ahamed-Ali <102580874+Ahamed-Ali@users.noreply.github.com>
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 root cause of the layout freeze on iPhone XS is a microscopic floating-point precision error in
UIKit’s SafeAreaInsetsreporting. Instead of returning a clean zero, iPhone XS provides a non-zero value (3.5527136788005009e-15) for the left inset.This value is treated by the layout system as a legitimate inset change, triggering a layout re-evaluation. Since the value never stabilizes to an exact zero, the system enters an infinite layout loop.
Other iPhone models such as iPhone 11 and iPhone 16 return precise
{0,0,0,0}insets and are not affected.Description of Change
This change applies a strict floating-point threshold (1e-14) to treat such negligible values as zero before passing them into the layout system. The chosen tolerance is precise enough to eliminate false positives without suppressing valid sub-pixel safe area insets on high-resolution displays.
This ensures stable layout behavior across devices while preserving layout precision for real safe area adjustments.
Issues Fixed
Fixes #30629 failing test case - LabelShouldSizeProperlyOnCollectionView
Tested the behaviour in the following platforms
Output Video
BeforeFix.mov
AfterFix.mov