dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

Role "Button" not announced by TalkBack for Spans with GestureRecognizer #25763

Open ChristopherStephan opened 6 days ago

ChristopherStephan commented 6 days ago

Description

When using a formatted label with a hyperlink, Android's screen reader TalkBack does not announce the role "Button" for the hyperlink.

<Label>
    <Label.FormattedText>
        <FormattedString>
            <Span Text="Alternatively, click " />
            <Span Text="here"
                  TextColor="Blue"
                  TextDecorations="Underline">
                <Span.GestureRecognizers>
                    <TapGestureRecognizer Command="{Binding TapCommand}"
                                          CommandParameter="https://learn.microsoft.com/dotnet/maui/" />
                </Span.GestureRecognizers>
            </Span>
            <Span Text=" to view .NET MAUI documentation." />
        </FormattedString>
    </Label.FormattedText>
</Label>

Actual outcome: "Alternatively, click here to view .NET MAUI documentation" Expected outcome: "Alternatively, click here to view .NET MAUI documentation., Button"

On iOS with VoiceOver the button role is announced as expected.

Steps to Reproduce

  1. Create a Label with a Span that has a Gesture Recognizer
  2. Start Android's screen reader TalkBack

Actual outcome: The screen reader does not announce the role "Button" of the Span that has a Gesture Recognizer Expected outcome: The role "Button" is announced

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

ninachen03 commented 5 days ago

This issue has been verified using Visual Studio 17.12.0 Preview 5(9.0.0-rc.2.24503.2 & 8.0.92 & 8.0.3). Can repro this issue at android platform

mattleibow commented 5 days ago

@ninachen03 do you still have the repro you created?

ninachen03 commented 5 days ago

@mattleibow here is repro for you. MauiApp37.zip