-
Notifications
You must be signed in to change notification settings - Fork 257
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
POC: button aria-labelledby #1446
Conversation
packages/main/src/Button.js
Outdated
let result = ""; | ||
|
||
ids.forEach((elementId, index) => { | ||
const element = document.querySelector(`#${elementId}`); |
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.
This should not be the document, but the HTML document of the ui5-button itself. It may be an iframe, a shadow root, etc...
Otherwise when you have ui5-button in a shadow root for example this won't work.
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.
Done
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.
This line should be:
const element = owner.querySelector(`[id='${elementId}']`);
Otherwise it causes this error
DOMException: Failed to execute 'querySelector' on 'Element': '#itemCollection:13:b906ffa3-face-419d-81e6-967147bf9ff1-groupLabel' is not a valid selector.
for some id's
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.
Fixed in #1500
let currentCustomElementFlag = true; | ||
|
||
while (node) { | ||
if (node.toString() === "[object ShadowRoot]") { |
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.
This won't work on IE, not sure how relevant it is for screen readers.
document.querySelector("ui5-button").shadowRoot.toString()
"[object Object]"
Please see if there is another way to check this
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.
It works on IE, because it doesn't have shadow root. Just like in Chrome for example for custom elements with no shadow root
Fixes #1425 |
No description provided.