-
Notifications
You must be signed in to change notification settings - Fork 137
Add namefrom: heading. #2650
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
base: main
Are you sure you want to change the base?
Add namefrom: heading. #2650
Conversation
✅ Deploy Preview for wai-aria ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Tagging F2FCandidate because if this third-attempt PR (or maybe it’s the fifth?) hasn't merged by TPAC, we should lock the doors until it is. |
|
@cookiecrook i had done this work as well for html aam #2215 |
|
Taking a note from the WG call today to double-check the history for |
|
Discussed during triage today: https://www.w3.org/2025/10/09-aria-minutes.html#31d8 I believe @cookiecrook has some follow up tasks and we are primarily waiting for a second implementation or stronger implementation commitment. |
|
Confirmed |
|
Both |
…ined in the PR comment thread
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.
Adding comments to make review easier.
| </tr> | ||
| <tr> | ||
| <th class="role-namefrom-head" scope="row">Name From:</th> | ||
| <td class="role-namefrom">author</td> |
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.
Reviewer context: this is on the dialog role
| </tr> | ||
| <tr> | ||
| <th class="role-namefrom-head" scope="row">Name From:</th> | ||
| <td class="role-namefrom">author</td> |
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.
Reviewer context: this is on the article role
| </tr> | ||
| <tr> | ||
| <th class="role-namefrom-head" scope="row">Name From:</th> | ||
| <td class="role-namefrom">author</td> |
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.
Reviewer context: this is on the alertdialog role
| modal dialog design patterns. | ||
| </p> | ||
| <p>Authors SHOULD provide an accessible name for a dialog, which can be done with the <pref>aria-label</pref> or <pref>aria-labelledby</pref> attribute.</p> | ||
| <p>Authors SHOULD provide an accessible name for a dialog, using either <a href="#namecalculation">namefrom</a>: author or <a href="#namecalculation">namefrom</a>: heading.</p> |
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.
Given a dialog that contains an <h2> for example, would it be preferable for authors to use aria-labelledby or rely on nameFrom: heading? Should nameFrom: author be preferred over nameFrom: heading?
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.
Yes, the AccName computation prioritizes namefrom:author first... namefrom:heading is only used as a fallback.
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.
The direct author reference is probably slightly more performant, but I don't think a change is needed here unless you have one to suggest.
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.
Just a personal clarification to make sure I'm using this new nameFrom technique properly 😄
|
@cookiecrook One thought that came to mind during implementation was around the descendant element with |
|
Lucas, in this comment, indicated potential Q4 2025 support for Chromium/Edge. |
Co-authored-by: Rahim Abdi <abdi.abdirahim@gmail.com>
Co-authored-by: Rahim Abdi <abdi.abdirahim@gmail.com>
|
@rahimabdi wrote:
What's special about a heading containing a an image or link that would not also apply to some other type of content? The label derived for the element that supports |
This commit supersedes PR #2215
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.
LGTM 🚀
|
In general, this makes sense to me. However, I'm wondering if there has been any discussion anywhere regarding mutations, events and the performance thereof. When the name of anything changes, the browser should ideally fire a name change event. The importance of this differs between operating systems and browser implementations, but it's still generally the right thing to do. For Firefox (and I assume Chromium), failure to fire an event could result in a stale cross-process cache, so it's particularly important there. However, clients may depend on the event as well. There are two particular challenges here:
@rahimabdi, does WebKit fire name change events for these cases? Did you run into any issues implementing those? I'd also be curious as to whether anyone has done any design thinking on this for Chromium and considered these issues. Thanks! |
| </li> | ||
| <li> | ||
| If the <a data-cite="accname-1.2/#dfn-accessible-name">accessible name</a> is still empty, then: if the `dialog` element has a | ||
| <a href="https://dom.spec.whatwg.org/#concept-tree-descendant">descendant</a> element with a role of `heading`, then use the |
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 refers explicitly to a DOM descendant. Does this mean aria-owns content should explicitly be excluded from this check? For example, should we skip NameFrom: heading in this case?
data:text/html,<article aria-owns="content"></article><div id="content"><h1>Some heading</h1>
Does that also mean we shouldn't consider aria-owns content when doing name computation for a dialog? For example, in this case, do we take first or second as the label of the dialog?
data:text/html,<article aria-owns="first second"><h1 id="second">second</h1></article><h1 id="first">first</h1>
I think we should respect aria-owns for consistency. That means we should be using accessibility descendants.
Co-authored-by: James Teh <jamie@jantrid.net>
Closes w3c/accname#138
Closes #1018
Closes #1860
Closes #2209
Closes w3c/accname#182
Closes w3c/accname#229
Related to #2215
Add namefrom: heading again; Will year 6 be the year?
Roles that are affected: now
namefrom: author, heading:History and Readiness:
I was worried this might never make it into the spec, but we now have:
Please re-review and merge this ASAP before this layered PR stagnates again... Thanks!
Implementation tracking
Preview | Diff