maui icon indicating copy to clipboard operation
maui copied to clipboard

[Android] SemanticProperties.HeadingLevel not working in ListView

Open ramonB1996 opened this issue 1 year ago • 3 comments

Description

I am trying to make a Label inside a ListView accessible by using SemanticProperties.HeadingLevel="Level1". This should be used by Android Talkback and tell the user that the label is a heading. Sadly, that part seems to be ignored inside a ListView

This works correctly on iOS!

Please let me know if there are any questions :)

Steps to Reproduce

  1. Clone: https://github.com/ramonB1996/MauiListViewA11yIssue
  2. Enable Talkback
  3. Confirm the bug when going through the items in the list

Link to public reproduction project repository

https://github.com/ramonB1996/MauiListViewA11yIssue

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

Sadly, no.

In Xamarin.Forms we created an A11YEffect that added these lines of code when a label should be a heading:

ViewCompat.SetAccessibilityHeading(control, true);
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
    control.AccessibilityHeading = true;

I tried doing this in a Behavior with Maui, but that did not change the outcome.

Relevant log output

No response

ramonB1996 avatar Apr 15 '24 06:04 ramonB1996

Verified this issue with Visual Studio 17.10.0 Preview 3 (8.0.20 &8.0.14).I can repro this issue on android(xiaomi)physical.

ninachen03 avatar Apr 15 '24 10:04 ninachen03

Did you try with the CollectionView?

jsuarezruiz avatar Apr 15 '24 14:04 jsuarezruiz

@jsuarezruiz I tried my sample with a CollectionView instead. This yields the same results as with ListView. It does not work for Android, but works for iOS.

ramonB1996 avatar Apr 16 '24 06:04 ramonB1996

@ramonB1996 I found this problem in the maui source code. The fact is that the Heading value is not set to true when necessary. Maybe they just forgot. Also, it didn't work not only for collections, but for all controls

BlotskiyDmitriy avatar Apr 30 '24 07:04 BlotskiyDmitriy

@BlotskiyDmitriy Thanks for creating a PR on this. However, I am pretty sure this worked on default controls like a Label. Are you sure it does not work everywhere? I thought only collections were a problem.

ramonB1996 avatar Apr 30 '24 10:04 ramonB1996

@ramonB1996 I added your example to the Maui Sandbox and tried to reproduce the problem with a simple Label. After setting the HeadingLevel with the TalkBack function enabled, the phrase "Heading" isn't said

BlotskiyDmitriy avatar Apr 30 '24 10:04 BlotskiyDmitriy