-
Notifications
You must be signed in to change notification settings - Fork 272
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
Conversation
892dc2d
to
6f1ff6d
Compare
*/ | ||
const getAssociatedLabelForTexts = el => { | ||
const results = []; | ||
const labels = document.querySelectorAll(`[ui5-label][for="${el.id}"],label[for="${el.id}"]`); |
There was a problem hiding this comment.
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()
docs/2-advanced/07-accessibility.md
Outdated
@@ -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. |
There was a problem hiding this comment.
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 :)
Part of #5827