question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ui5-select: [a11y] the aria-label of ui5-select is overridden by the aria-labelledby attribute

See original GitHub issue

Describe the bug When set the aria-labelledby attribute in ui5-select, the screen reader will not output the label defined instead of the text of selected option

To reproduce Steps to reproduce the behavior: Considering following case,

<ui5-label id="myLabel3" for="mySelect" required show-colon>Job</ui5-label>
<ui5-select id="mySelect" aria-required="true" aria-labelledby="myLabel3">
	<ui5-option>Manager</ui5-option>
	<ui5-option>Sales</ui5-option>
	<ui5-option selected>Developer</ui5-option>
</ui5-select>

Expected behavior The label of ui5-select should be output by screen reader

Screenshots Please refer to the DOM structure in the screenshot image

Context

  • UI5 Web Components version: 0.23.1
  • OS/Platform: MacOs
  • Browser (if relevant): Chrome
  • Other information: screen reader - NVDA

Affected components (if known) ui5-select

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zhangliangyicommented, Aug 26, 2020

Here is some documentation about the relationship between aria-label and aria-labelledby. https://developers.google.com/web/fundamentals/accessibility/semantics-aria/aria-labels-and-relationships

Importantly, aria-labelledby overrides all other name sources for an element. So, for example, if an element has both an aria-labelledby and an aria-label, or an aria-labelledby and a native HTML label, the aria-labelledby label always takes precedence.

So maybe this is the cause of my issue.

0reactions
nnaydenowcommented, Jan 4, 2021

Hello @zhangliangyi,

The internal aria-labelledby is removed when the role was changed to combobox, because it provides different accessibility behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ARIA Labeling - Documentation - Demo Kit - SAPUI5 SDK
Attribute is maintained on the labeled control. Only indirect support for multiple texts. The aria-labelledBy attribute. Whitespace separated list of ID ...
Read more >
Best Practices for ARIA Labeling - SAPUI5 - SAP Help Portal
Sometimes the UI and the control usage may not allow standard ARIA labeling. Here we introduce some best practices on handling the labels...
Read more >
Accessibility - UI5 Web Components - SAP
Those labels are passed as a concatenated string to the aria-label attribute. accessibleRole, role, Sets the accessible aria role of the component.
Read more >
UI5: How to use Association 'ariaLabelledBy'? - Stack Overflow
ARIA (Accessible Rich Internet Applications) is a set of attributes that helps people with disabilities to access a web page e.g. with a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found