maui icon indicating copy to clipboard operation
maui copied to clipboard

Span's TapGestureRecognizer not working if text is truncated

Open Veilenus opened this issue 4 months ago • 1 comments

Description

Consider a Label with FormattedText and a TapGestureRecognizer attached to one of its Spans. The TapGestureRecognizer does not execute the Command if the Label's text is truncated, either as a result of limiting MaxLines and the available width or by limiting both, width and height.

This bug affects the app on Windows, but not on Android. Other platforms are untested.

Tested versions:

  • 8.0.20 (bug present)
  • 8.0.10 (bug present)

Steps to Reproduce

  1. Check out the attached reprodution repo and start the app on Windows.
  2. Click the highlighted Labels.
  3. Observe that only Labels whose text is fully visible will execute the command (i.e. update the counter).

Link to public reproduction project repository

https://github.com/Veilenus/FormattedTextGestureRecognizerBug

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

Unfortunately, no. A hacky one might be considered if the Label's FontSize and LineHeight are statically known, thus allowing to wrap the Label in a Layout of choice and limiting the latter's HeightRequest instead of the Label's MaxLines.

Relevant log output

No response

Veilenus avatar Apr 15 '24 11:04 Veilenus

Verified on VS 17.10.0 Preview 3.0(8.0.20). Repro on Windows 11, iOS 17.2 and MacCatalyst, not repro on Android 14.0-API34 with below Project: FormattedTextGestureRecognizerBug.zip

XamlTest avatar Apr 16 '24 02:04 XamlTest