ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

ui5-li, ui5-li-custom: aria-label not supported

Open agauyeung opened this issue 6 years ago • 4 comments

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

agauyeung avatar Apr 03 '20 23:04 agauyeung

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>

fifoosid avatar Apr 08 '20 10:04 fifoosid

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.

agauyeung avatar Apr 10 '20 18:04 agauyeung

Hi @agauyeung

We should separate the issue for the two components:

  1. ui5-li To 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.

  2. ui5-li-custom When 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 using ui5-li-custom you 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?

fifoosid avatar Apr 14 '20 08:04 fifoosid

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.

fifoosid avatar May 15 '20 12:05 fifoosid