ui5-li, ui5-li-custom: aria-label not supported
Describe the bug Standard List Item and Custom List Item do not support aria-label.
To reproduce Adding aria-label to either ui5-li or ui5-li-custom are not reflected in their respective shadow DOMs.
Isolated example https://codesandbox.io/s/ui5-webcomponents-fu0lm
Expected behavior The "li" element in the shadow DOM should have the aria-label defined in the web component.
Affected components (if known)
- ui5-li
- ui5-li-custom
Hi @agauyeung
What exactly are you trying to achieve?
If you want to add a text to be read out for every ui5-li or ui5-li-custom you can just add it like this:
<ui5-li aria-label="Some information to be read out">
...
</ui5-li>
Hi @fifoosid
Please correct me if I am not understanding this properly, but my understanding is that screenreaders have no knowledge of web components and how to read them. Given that, they just read the shadow DOM of each web component. In this particular case, ui5-list uses an HTML list internally and ui5-li and ui5-li-custom use <li> internally. The screenreader will be reading the <li> inside the shadow DOM of these web components, not the <ui5-li>and <ui5-li-custom> themselves. I added aria-labels to these 2 web components, inspected the shadow DOM of <ui5-li> and <ui5-li-custom>, and their <li> elements do not have the aria-label defined. So even though the web component has the aria-label defined outside, the <li> element inside (which is read by the screenreader) does not have this aria-label.
Hi @agauyeung
We should separate the issue for the two components:
-
ui5-liTo this tag you should not set neither aria-label nor aria-labelledby attributes, because you can have limited content(that comes from properties). The accessibility of the component is built with the data that comes from these properties(description, info...) and it is read as expected without any attributes set from outside. -
ui5-li-customWhen it comes to the custom list item, it is a little more difficult to have abstract point of view, because you can have literally everything inside. However, when usingui5-li-customyou have access to the html so it not a problem to add aria-label for example and it will be read as expected.
Could you please specify what exactly your problem is. Is it that the attribute is not set on the internal li tag, that some component is not read properly by screen readers or something else?
I am closing this due to inactivity. If you still experience the issue, don't hesitate to reopen the issue or create a new one.