[iOS] Fix Label Span formatting test failures on candidate branch#35815
Merged
kubaflo merged 1 commit intoJun 9, 2026
Merged
Conversation
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
kubaflo
approved these changes
Jun 9, 2026
This was referenced Jun 10, 2026
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.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
PR #31159 ("Improve Label Mapping Performance") introduced a regression in three iOS Label snapshot tests:
As a result, Spans lose font attributes, line height, and character spacing inherited from the Label.
Root Cause
In Label.Mapper.cs, MapFont was modified to include && !handler.IsConnectingHandler() in the HasFormattedTextSpans check. During handler connection, this causes execution to fall through to baseMethod, which ultimately calls UILabel.Font = .... On iOS, setting UILabel.Font after AttributedText has already been assigned recreates the attributed string, removing the span-level formatting (such as bold/italic styling, line height, and character spacing) that was previously applied by MapText.
Test names:
Description of Change
Restructured MapFont so that when HasFormattedTextSpans is true, execution never falls through to baseMethod.
During handler connection, the redundant UpdateValue(FormattedText) call is still skipped to preserve the performance optimization introduced in PR #31159. However, UpdateFont is no longer called, preventing the already-correct AttributedText from being overwritten and preserving all span-level formatting.
Cause PR: #31159
Output
Test result