Skip to content

tooltip: allow aria-details in addition to aria-describedBy #2507

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

Open
pkra opened this issue Apr 3, 2025 · 5 comments
Open

tooltip: allow aria-details in addition to aria-describedBy #2507

pkra opened this issue Apr 3, 2025 · 5 comments
Assignees

Comments

@pkra
Copy link
Member

pkra commented Apr 3, 2025

The spec currently says

Authors SHOULD ensure that elements with the role tooltip are referenced through the use of aria-describedby before or at the time the tooltip is displayed.

It seems like aria-details might be a good alternative for authors and users (especially when done automatically via w3c/html-aam#545).

From a conversation with @scottaohara, the combination might also be useful, e.g.,

<a href=... aria-describedby=t aria-details=t>foo</a>

<div role=tooltip id=t aria-labelledby=h>
  <h3 id=h>whatever</h3>
  <p>all the slop here</p>
</div>

The describedBy could provide a brief summary (since the accDescription computation should stop once it gets the name of the tooltip) and the aria-details could be the signal that there's more content and an easy way to fully access it. (This example might also make it a candidate for #2215)

Maybe we can even resolve #979 with this new information.

@scottaohara
Copy link
Member

This makes me wonder if any of the automatic aria-details associations that have gone into recent HTML / CSS features might be updated.

E.g., maybe aria-details isn't exposed if someone specifies an aria-describedby association to the same element. BUT, both are used if the element is named - because then the calculated description should only be the name of the element, and the aria-details association is important to let someone know there's even more information available than what the description provided.

@MarioBatusic
Copy link
Contributor

I tested aria-details and aria-describedby in conjunction with the tooltip role.

  1. Regardless of whether the element with the tooltip role receives an accname (aria-label / aria-labelledby) or not, NVDA and JAWS speak both attribute values.
  2. If you use the same ID of the element with the tooltip role for both attributes, the entire contents of the tooltip element are read aloud—regardless of whether the tooltip element receives an accname or not. To get a short description, aria-describedby needs to get the ID of the element with this short description.
  3. The only information that JAWS and NVDA currently provide using Firefox or Chrome is that "details are present".

@scottaohara
Copy link
Member

here is a test case so we can make sure we're running off the same example
https://codepen.io/scottohara/pen/jEEOJvw

when i navigate to the test button (via tab key focus) - NVDA and JAWS both announce the description for the button as "foo" and each announce that the button "has details". it does not read the content of the tooltip because the tooltip is named and thus it only reads "foo".

if i navigate to the button with virtual cursor, i hear it has details with both nvda and jaws. jaws will announce the description "foo" unlike nvda.

i'm using default settings for both nvda and jaws - the same behavior exists when testing with both Firefox and Chrome/Edge. I'm curious if you continue to have a different experience testing from the same example, and if so, maybe what settings might be causing this diff.

@spectranaut
Copy link
Contributor

Discussed briefly in triage a few weeks ago: https://www.w3.org/2025/04/03-aria-minutes.html#02a4

@MarioBatusic
Copy link
Contributor

@scottaohara I have retested your codePen example and yes: All combinations with NVDA, JAWS, Firefox and Chrome it works - I hear as well that the button has Details and that its label referenced by aria-describedby is "foo".

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

5 participants