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

Accessibility issues with Panel

Open mastanshaikk opened this issue 6 years ago • 4 comments

Here are the following fixes needed to address A11y issues with Panel

  1. "ui5-panel-header" div should not have a role of button with aria-expanded, aria-controls attributes if the panel is fixed - cannot expand/collapse.
  2. "ui5-panel-root" div should be able to support aria-labelledby which either auto associate the header text div with class "ui5-panel-header-title" or an explicit element part of header slot where a target developer would be able to choose.
  3. "ui5-panel-header-button" ui5-button should be able to should be able to support aria-labelledby which either auto associate the header text div with class "ui5-panel-header-title" or an explicit element part of header slot where a target developer would be able to choose.

To reproduce Steps to reproduce the behavior:

  1. While a screen reader is on like NVDA, Press Insert + F7 to list out the items on the elements on the screen to fast navigate the screen, refer screen shots for details.

Expected behavior Make sure the issues listed in the description are addressed, where the screen reader lists the elements with appropriate context and the landmark "complementary" has a unique accessible name.

Screenshots

  1. Issue # 1 and 3, image
  2. Issue # 2 image

Context

  • UI5 Web Components version: 0.21.5
  • OS/Platform: All
  • Browser (if relevant): All
  • Other information: Screen reader NVDA

mastanshaikk avatar Jun 30 '20 02:06 mastanshaikk

Hi @vladitasev,

Some of the issues listed in this are not yet resolved: For item# 2: "ui5-panel-root" div should be able to support aria-labelledby which either auto associate the header text div with class "ui5-panel-header-title" or an explicit element part of header slot where a target developer would be able to choose.

  • The line https://github.com/SAP/ui5-webcomponents/blob/master/packages/main/src/Panel.hbs#L4 requires the same changes made for "ui5-panel-header" by assoicating the panel title as aria-label or aria-labelledby so that the complementory region has accessible name associated to it.

For item# 3: "ui5-panel-header-button" ui5-button should be able to should be able to support aria-labelledby which either auto associate the header text div with class "ui5-panel-header-title" or an explicit element part of header slot where a target developer would be able to choose.

  • The panel header text was not auto associated to expand/collapse button of the panel header, but supports on explicit add of aria-label or aria-labelledby on ui5-panel element, it's good to auto inherit from the panel header.

mastanshaikk avatar Sep 22 '20 00:09 mastanshaikk

Hi @mastanshaikk,

The solution you mentioned will result in double speech output of the aria-labelledby/header:

  • If we set the aria-labelledby of ui5-panel-root and ui5-panel-header to the header text the speech output would be - " heading...."
  • If we set the aria-labelledby of ui5-panel-root and ui5-panel-header to an element provided by the user via aria-label/aria-labelledby attribute of the ui5-panel component the speech output would be - " heading...." The same applies if we add aria-label/aria-labelledby pointing to the same thing in both the root and the button. Then the speech output will be: " button...."

For the "ui5-panel-header-button" it is relevant to provide an accessible name only when we have a header slot provided by the developer and this is implemented - when the developer provides an aria-label/aria-labelledby to the ui5-panel, we will map it to the button. In this case "should be able to support aria-labelledby which either auto associate the header text div" is not possible, since the header slot is a html node provided by the developer and we do not know if this slot would include a title/text content somewhere in the DOM to map it via aria-labelledby/aria-label. For the default case (when we have an expandable panel and a headerText) there is no need to provide a aria-labelledby/aria-label to the button since it only has an decorative role - it does not receive the focus and has a title set, which in my opinion is enough. If you think that this is not correct, we could add an aria-hidden or presentation role to this button.

So my solution here would be:

  • if we have an expandable panel with a header text and the developer provides aria-label/aria-labelledby to the ui5-panel: add an aria-label/aria-labelledby to the ui5-panel-root element (the one with the mapped accRole). In this way the speech output on focus would be: " heading..."
  • if we have an expandable panel and the developer provides a header slot and an aria-label/aria-labelledby the only solution would be to choose if we want to map the aria-label/aria-labelledby to the ui5-panel-root element or to the button, otherwise the aria-labelledby/aria-label will be read out twice on focus.

What do you think?

elenastoyanovaa avatar Oct 01 '20 07:10 elenastoyanovaa

Hi @elenastoyanovaa,

I am not sure the example provided with " heading..." is clear enough to understand your thought around it.

The key aspect of my proposals was to associate an accessible name to the panel root element with the role of "complementary" as shown in the screenshot image the panels were listed with no accessible name and expand/collapse button as well in image, it could be possible that if elements with the same accessible name were associated it might sound repetitive, but for the sake of avoiding repetitiveness removing accessible names for these elements would introduce barriers to access the elements via screen reader special keystrokes to list all landmarks or all buttons, all form elements etc. on the screen and by nature, it is not repetitive as the role, accessible name, state and accessible description of an element does identify the elements uniquely, its quite possible sometimes an end-user could feel that its repetitive, refer to the below example:

<html>
    <body>
        <input type="button" title="btnTitle" value="btn"/>
        <h3 id="header">Header</h3>
        <div>
            <input type="checkbox" aria-labelledby="header" aria-describedby="description"/>
            <span id="description">description text</span>
        </div>
    </body>
</html>

where the word "Header" will be announced for H3 and the input element, in browse mode it would sound as if it was repeated, but it isn't repetitive because they are two different elements where H3 was associated as aria-labelledby of the input element, where screenreader will list H3 as part of the list of headings on the screen and input element will be listed as part of form fields with same accessible name so, the input element accessible name shouldn't be avoided though it would sound repetitive.

In the context of the slot, to associate aria-labelledby: My statement "an explicit element part of header slot where a target developer would be able to choose" mean it is always with the target developer to provide the necessary association of aria-labelledby of an element with Id in the slot area as it's customized by the target developer, as a control/component author default option could be a non-slot element but with slot the responsibility is with target developer and the control author should facilitate it by allowing to associate aria-labelledby.

I, therefore, request you to help make the necessary changes so that these elements are accessible via various possible ways by end-users using the screen reader assistive tools.

mastanshaikk avatar Oct 12 '20 04:10 mastanshaikk

Hi @mastanshaikk,

Sorry for that. Some formatting issue with my comment. Please find the correct speech output below:

The solution you mentioned will result in double speech output of the aria-labelledby/header:

If we set the aria-labelledby of ui5-panel-root and ui5-panel-header to the header text the speech output would be - " panel-header-text heading panel-header-text ...." If we set the aria-labelledby of ui5-panel-root and ui5-panel-header to an element provided by the user via aria-label/aria-labelledby attribute of the ui5-panel component the speech output would be - " provided-label heading provided-label ...." The same applies if we add aria-label/aria-labelledby pointing to the same thing in both the root and the button. Then the speech output will be: "provided-label button provided-label...." For the "ui5-panel-header-button" it is relevant to provide an accessible name only when we have a header slot provided by the developer and this is implemented - when the developer provides an aria-label/aria-labelledby to the ui5-panel, we will map it to the button. In this case "should be able to support aria-labelledby which either auto associate the header text div" is not possible, since the header slot is a html node provided by the developer and we do not know if this slot would include a title/text content somewhere in the DOM to map it via aria-labelledby/aria-label. For the default case (when we have an expandable panel and a headerText) there is no need to provide a aria-labelledby/aria-label to the button since it only has an decorative role - it does not receive the focus and has a title set, which in my opinion is enough. If you think that this is not correct, we could add an aria-hidden or presentation role to this button.

So my solution here would be:

if we have an expandable panel with a header text and the developer provides aria-label/aria-labelledby to the ui5-panel: add an aria-label/aria-labelledby to the ui5-panel-root element (the one with the mapped accRole). In this way the speech output on focus would be: "provided-label heading panel-header-text ..." if we have an expandable panel and the developer provides a header slot and an aria-label/aria-labelledby the only solution would be to choose if we want to map the aria-label/aria-labelledby to the ui5-panel-root element or to the button, otherwise the aria-labelledby/aria-label will be read out twice on focus. What do you think?

elenastoyanovaa avatar Oct 23 '20 07:10 elenastoyanovaa