Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-label): improve "for" attribute accessibility reading #5872

Merged
merged 11 commits into from
Oct 12, 2022

Conversation

TeodorTaushanov
Copy link
Member

@TeodorTaushanov TeodorTaushanov commented Sep 30, 2022

Part of #5827

@TeodorTaushanov TeodorTaushanov changed the title fix(ui5-radiobutton): improved accessibility fix(ui5-label): improve "for" attribute accessibility reading Oct 3, 2022
*/
const getAssociatedLabelForTexts = el => {
const results = [];
const labels = document.querySelectorAll(`[ui5-label][for="${el.id}"],label[for="${el.id}"]`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't find the label if it is in shadow dom. Take a look at "Using a Label inside Shadow Root" here http://localhost:8080/packages/main/test/pages/Label.html
Just replace document with el.getRootNode()

dimovpetar
dimovpetar previously approved these changes Oct 6, 2022
@@ -11,7 +11,7 @@ Web Components allow developers to make their own custom components with native

This is not needed in UI5 Web Components, because when using our elements, all relevant accessibility attributes for a certain component will be applied in the shadow DOM, without further setup. Additionally, many accessibility-related APIs are available. They can be used to enhance the accessibility in the context of each application.

As the Web Components are a new standard, there are still some gaps in regard to accessibility. For example - setting IDRef relationships is currently not possible due to the nature of the custom elements and their shadow DOM. This is a limitation in the ARIA support and there is a draft of a new [AOM (Accessibility Object Model)](https://github.com/WICG/aom), which addresses this issue and many more, and aims at a better JS-based accessibility support for all web elements. We are continuously working on improving the existing limitations. For example, in order to create a Label-Input relationship, you could simply use the `accessible-name` or `accessible-name-ref` properties of the input components in order to set the accessible name for the desired input.
As the Web Components are a new standard, there are still some gaps in regard to accessibility. For example - setting IDRef relationships is currently not possible due to the nature of the custom elements and their shadow DOM. This is a limitation in the ARIA support and there is a draft of a new [AOM (Accessibility Object Model)](https://github.com/WICG/aom), which addresses this issue and many more, and aims at a better JS-based accessibility support for all web elements. We are continuously working on improving the existing limitations. For example, in order to create a Label-Input relationship, you can use the `for` property of the label component to bound the label to an input or `accessible-name-ref` property of the input component to bound the input to a label.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simonarangelova Could you please have a look at the documentation updates :)

packages/main/test/samples/Label.sample.html Outdated Show resolved Hide resolved
@TeodorTaushanov TeodorTaushanov merged commit b9ffaa6 into main Oct 12, 2022
@TeodorTaushanov TeodorTaushanov deleted the label_acc branch October 12, 2022 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants