Skip to content

[iOS] Span's TapGestureRecognizer not working if text is truncated - UITest#22213

Merged
PureWeen merged 1 commit into
dotnet:inflight/currentfrom
kubaflo:fix-21837
Aug 15, 2025
Merged

[iOS] Span's TapGestureRecognizer not working if text is truncated - UITest#22213
PureWeen merged 1 commit into
dotnet:inflight/currentfrom
kubaflo:fix-21837

Conversation

@kubaflo

@kubaflo kubaflo commented May 5, 2024

Copy link
Copy Markdown
Contributor

Issues Fixed

Windows is not working either, but I have no machine to work on it
Fixes #21837

Before After
Screen.Recording.2024-05-05.at.20.33.23.mov
Screen.Recording.2024-05-05.at.20.31.50.mov

@kubaflo kubaflo requested a review from a team as a code owner May 5, 2024 22:48
@kubaflo kubaflo requested review from PureWeen and mattleibow May 5, 2024 22:48
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label May 5, 2024
@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

Comment thread src/Controls/tests/UITests/Tests/Issues/Issue21837.cs Outdated
@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

Comment thread src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs Outdated
@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

jsuarezruiz
jsuarezruiz previously approved these changes Jun 10, 2024

@tj-devel709 tj-devel709 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is in the right direction and definitely when there is truncation, this is not working correctly because it is looking for the rect around the last character but that character is not rendered and get an empty rect.

The issue I see with using the finalSize.Bottom is when we have a frame that is longer than the span we'd like, there is extra space being added to the 'hitbox' area of the span that we do not want.

Screen.Recording.2024-07-11.at.5.08.17.PM.mov
<Label AutomationId="label7" HorizontalOptions="Start" MaxLines="5" BackgroundColor="LightGoldenrodYellow" WidthRequest="200" HeightRequest="400">
            <Label.FormattedText>
                <FormattedString>
                    <Span Text="Only our MaxLines differ. Otherwise we're the same. Please tap us!">
                        <Span.GestureRecognizers>
                            <TapGestureRecognizer Command="{Binding TapCommand}" />
                        </Span.GestureRecognizers>
                    </Span>
                </FormattedString>
            </Label.FormattedText>
        </Label>

This is a great idea though and maybe it can be tweaked to find a good middle ground

@tj-devel709

Copy link
Copy Markdown
Member

Perhaps something like a check if the endRect is the empty rect and the startRect is not the empty rect, then maybe that is enough to assume there is truncation going on and we can use the finalSize?

@kubaflo

kubaflo commented Mar 16, 2025

Copy link
Copy Markdown
Contributor Author

Hi @tj-devel709 I've rebased and the issue seems to be fixed. So maybe just merge the UI test I've added and close this bug?

@kubaflo kubaflo changed the title [iOS] Span's TapGestureRecognizer not working if text is truncated [iOS] Span's TapGestureRecognizer not working if text is truncated - uiTest Mar 16, 2025
@kubaflo kubaflo changed the title [iOS] Span's TapGestureRecognizer not working if text is truncated - uiTest [iOS] Span's TapGestureRecognizer not working if text is truncated - UITest Mar 16, 2025
@kubaflo kubaflo self-assigned this Mar 16, 2025
@mattleibow

Copy link
Copy Markdown
Member

/azp run MAUI-UITests-public

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current August 15, 2025 23:23
@PureWeen PureWeen merged commit 567aa26 into dotnet:inflight/current Aug 15, 2025
75 of 77 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 15, 2025
github-actions Bot pushed a commit that referenced this pull request Aug 19, 2025
github-actions Bot pushed a commit that referenced this pull request Aug 22, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-gestures Gesture types community ✨ Community Contribution platform/ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Span's TapGestureRecognizer not working if text is truncated

5 participants