Skip to content

Conversation

@scottaohara
Copy link
Member

closes #2303

This updates a custom element's default role to none to allow attribute reflection from the custom element parent to its internals.

This change provides additional clarification about how a custom element can be provided a role by authors, and what caveats would change a custom element's default role of none, to another implicit minimum role.

Test, Documentation and Implementation tracking

Once this PR has been reviewed and has consensus from the working group, tests should be written and issues should be opened on browsers. Add N/A and check when not applicable.

  • "author MUST" tests:
  • "user agent MUST" tests:
  • Browser implementations (link to issue or commit):
    • WebKit:
    • Gecko:
    • Blink:
  • Does this need AT implementations?
  • Related APG Issue/PR:
  • MDN Issue/PR:

@scottaohara scottaohara marked this pull request as draft November 22, 2024 20:16
@netlify
Copy link

netlify bot commented Nov 22, 2024

Deploy Preview for wai-aria ready!

Name Link
🔨 Latest commit a4d84a8
🔍 Latest deploy log https://app.netlify.com/projects/wai-aria/deploys/68c041948166bd0008627293
😎 Deploy Preview https://deploy-preview-2383--wai-aria.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@scottaohara
Copy link
Member Author

marking as draft as the form associated custom element mapping table also needs updating - but i want to make sure i got this going in the right direction before i edit that table too

@scottaohara scottaohara marked this pull request as ready for review November 22, 2024 22:10
Copy link
Contributor

@aleventhal aleventhal left a comment

Choose a reason for hiding this comment

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

Awesome, after many iterations

aarongable pushed a commit to chromium/chromium that referenced this pull request Dec 3, 2024
Update custom role rules and tests based on new text at
w3c/aria#2383

Behind feature flag:
--enable-blink-features=AccessibilityCustomElementRoleNone

Intent to prototype / chromestatus entry:
https://chromestatus.com/feature/5079996916563968?gate=5150348547981312

Bug: w3c/aria#2303
Bug: WICG/webcomponents#1073
Bug: 379674023
Change-Id: If317916b432bc5a627c8ea6fa0654e6c98a10ea6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6042465
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391105}
<ul>
<li>If the author assigned a conforming ARIA role using the `role` attribute, or by the custom element's internals: map to the specified role.</li>
<li>else if the author assigned HTML attributes that result in a <a>minimum role</a>: map to the minimum role.</li>
<li>else if the custom element is focusable: map to the <a class="core-mapping" href="#role-map-generic">`group`</a> role</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why group? Could we map to unknown or something and log a warning?

Copy link
Contributor

Choose a reason for hiding this comment

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

also this links to generic, not group

Copy link
Contributor

Choose a reason for hiding this comment

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

that typo maight be easier to avoid using the respective <rref> tag...

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed the incorrect link. i never thought to use rref in html aam - wasn't sure that'd work. i don't see that used in core aam either.

maybe it'd work now with the specs all in one repo?

re: about mapping to group or something else - i'm open to ideas. cc @aleventhal if you have thoughts?

@spectranaut
Copy link
Contributor

@cookiecrook can you respond to @scottaohara comments to help move this forward?

Copy link

@jcsteh jcsteh left a comment

Choose a reason for hiding this comment

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

Sorry for the ridiculously slow turnaround here. Just a couple of questions, but overall this looks good to me.

This updates a custom element's default role to none to allow attribute reflection from the custom element parent to its internals.

Just to be extra clear, when you say "allow attribute reflection" here, you mean that the component could copy attributes itself (e.g. aria-label), not that these would be implicitly reflected somehow? Nothing in the proposed spec text suggests implicit reflectoin; I just wanted to double check my understanding.

<ul>
<li>If the author assigned a conforming role using the `role` attribute, or by the custom element's internals: map to the specified role.</li>
<li>else if the author assigned HTML attributes that result in a <a>minimum role</a>: map to the minimum role.</li>
<li>else if the custom element is focusable: map to the <a class="core-mapping" href="#role-map-group">`group`</a> role</li>
Copy link

Choose a reason for hiding this comment

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

Should this be done even if a custom element's ShadowRoot has delegatesFocus: true? It's a tricky one. On one hand, it's a pretty important principle to expose focusable elements to accessibility. On the other hand, when delegatesFocus is true, the element isn't in the tab order; it is effectively transparent as far as focus is concerned.

I think it's probably safer to still use role="group" even for delegatesFocus: true. For example, browser native date/time inputs expose the container and allow it to be focused, even though it isn't part of the tab order. Nevertheless, I thought I'd clarify because I haven't seen any discussion of delegatesFocus either here or in #2303.

closes #2303

This updates a custom element's default role to none to allow attribute reflection from the custom element parent to its internals.

This change provides additional clarification about how a custom element can be provided a role by authors, and what caveats would change a custom element's default role of none, to another implicit minimum role.
scottaohara and others added 15 commits September 9, 2025 16:55
pull comments into role table cell
combine custom elements and form associated custom elements into a single mapping table
update wording to be consistent between steps
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
Co-authored-by: James Craig <cookiecrook@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

9.3 Presentational Roles Conflict Resolution does not consider custom element use cases

6 participants