dotnet / dotnet/maui

Incorrect sender for TapGestureRecognizer.Tapped in Span.GestureRecognizers

Open
#28,176 1 comment 0 reactions 0 assignees View on GitHub
area-controls-label area-gestures platform/android t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

Adding a TapGestureRecognizer to Span's GestureRecognizers causes the Tapped handler to be invoked with the enclosing `Label` as the sender, which is incorrect. The sender should be the `Span`.

```














```

```
private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
{
// sender should be a Span. It's a Label instead.
}
```

Since Span derives from GestureElement, it's strange that the handler is invoked with the enclosing Label instead. Sender should be the span.

### Steps to Reproduce

_No response_

### Link to public reproduction project repository

_No response_

### Version with bug

9.0.40 SR4

### Is this a regression from previous behavior?

No, this is something new

### Last version that worked well

_No response_

### Affected platforms

Android, I was *not* able test on other platforms

### Affected platform versions

_No response_

### Did you find any workaround?

No workaround.

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the TapGestureRecognizer handling used by Span.GestureRecognizers, focusing on how the enclosing Label becomes the event sender on Android. Verify the behavior with the provided Label, FormattedString, and Span structure; done means the Tapped handler receives the Span rather than the Label.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.