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

Element.prototype.role #1612

Closed
jonathantneal opened this issue Sep 7, 2021 · 3 comments
Closed

Element.prototype.role #1612

jonathantneal opened this issue Sep 7, 2021 · 3 comments
Assignees

Comments

@jonathantneal
Copy link

I’ve noticed that Element.prototype.role has an incomplete implementation in Safari.

document.createElement('button').role // null

Object.assign(document.createElement('button'), { role: 'button' }).role // "button"

I would have expected this reflection:

document.createElement('a').role // null
Object.assign(document.createElement('a'), { href: '' }).role // "link"

document.createElement('h1').role // "heading"
Object.assign(document.createElement('h1'), { role: 'button' }).role // "button"

Is there documentation or a proposal for this behavior specified somewhere?

Would this be part of ARIA, AOM, or something else?

@jnurthen
Copy link
Member

jnurthen commented Sep 7, 2021

@jonathantneal does https://wicg.github.io/aom/explainer.html#what-happened-to-accessiblenode help explain why this doesn't work today?

ARIA 1.2 only defines reflection of explicitly defined ARIA roles - it does not imply that implicit roles are exposed and indeed this is unlikely at this point in time. It sounds like you want https://wicg.github.io/aom/explainer.html#full-introspection-of-an-accessibility-tree---computedaccessiblenode which IMO is unlikely to ever be implemented outside of testing/developer tooling.

@jonathantneal
Copy link
Author

The rationale in that document seems specific to one particular implementation that never shipped. Based on what ships in Safari, I would have expected role followed https://w3c.github.io/html-aam/.

I’m pretty unsure where my issue belongs. Still, Perhaps I can better organize my questions:

  1. Where is or is there documentation for Element.prototype.role?
  2. Is there interest in or would this be the place to discuss defining Element.prototype.role (as following html-aam), or actively discouraging its usage?

@jnurthen jnurthen added this to the ARIA 1.3 milestone Sep 9, 2021
@cookiecrook
Copy link
Contributor

@jonathantneal computedRole is being discussed as part of both WebDriver and AOM, but what you're requesting has some implementation blockers at the moment. In particular, role heuristics are usually only computed if AT needs it. Allowing web authors to trigger this on demand (by checking the computed role) has performance implications.

Closing, but reopen if you think this is worth continuing discuss within ARIA.

@cookiecrook cookiecrook removed this from the ARIA 1.3 milestone Jun 30, 2022
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

No branches or pull requests

4 participants