-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fixed - On iOS GestureRecognizers don't work on Span in a Label, which doesn't get IsVisible (=true) update from its parent #29024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…doesn't get IsVisible (=true) update from its parent
Hey there @@KarthikRajaKalaimani! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
@@ -149,7 +149,7 @@ internal static void RecalculateSpanPositions(this UILabel control, Label elemen | |||
return; | |||
} | |||
|
|||
var finalSize = control.Bounds; | |||
var finalSize = size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider updating the XML documentation for RecalculateSpanPositions to document the new 'size' parameter and its role in reflecting the arranged bounds from LabelHandler. This will help maintain clarity for future developers maintaining this internal method.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
Issue Details:
The Tapped event or Command of the TapGestureRecognizer is not triggered for span text when tapped on iOS and Mac platforms.
Root Cause:
In the RecalculateSpanPositions method of the FormattedStringExtension class, span regions are created only when the native bounds are greater than 0. In our scenario, the native bounds of the Label were 0 when its visibility changed from false to true. So, we added an early return in the RecalculateSpanPositions method when the native bounds are 0, preventing the creation of invalid span regions.
Description of Change:
Since RecalculateSpanPositions is invoked from the ArrangeOverride method in LabelHandler.iOS, where the actual size of the label is available, I modified the logic to pass the correct bounds from the Arrange step. These bounds are then used in RecalculateSpanPositions to create span regions, instead of relying on potentially outdated native label bounds.
Tested the behavior in the following platforms.
Reference:
N/A
Issues Fixed:
Fixes #28949
Screenshots
Screen.Recording.2025-04-16.at.4.46.52.PM.mov
Screen.Recording.2025-04-16.at.4.50.51.PM.mov