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

POC: button aria-labelledby #1446

Merged
merged 3 commits into from
Apr 13, 2020
Merged

POC: button aria-labelledby #1446

merged 3 commits into from
Apr 13, 2020

Conversation

fifoosid
Copy link
Contributor

@fifoosid fifoosid commented Apr 8, 2020

No description provided.

let result = "";

ids.forEach((elementId, index) => {
const element = document.querySelector(`#${elementId}`);
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link

@ee92 ee92 Apr 17, 2020

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

Copy link
Contributor Author

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]") {
Copy link
Contributor

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

Copy link
Contributor Author

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

@fifoosid
Copy link
Contributor Author

Fixes #1425

@fifoosid fifoosid merged commit e54111f into master Apr 13, 2020
@fifoosid fifoosid deleted the button-aria-labelledby branch April 13, 2020 12:54
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.

None yet

3 participants