-
Notifications
You must be signed in to change notification settings - Fork 378
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
RfC: API design for aria delegation mechanism #917
Comments
During F2F today, we discussed an alternative where we'd add a boolean something like |
FWIW, |
Is the plan for there to be a whole series of per-property |
I'm assigning this work to myself as discussed today at the AOM meeting. I don't have write permissions to do this formally in this github org, but this comment might be good enough for now. The general understanding is that we have consensus for this and the next step is drafting the specs. Following this I should work on #916. Thanks! |
To ensure I understand, this proposal gives no new capabilities; it just makes it easier to coordinate instead of manually synchronizing |
My understanding is this proposal allows usage of web components to have aria attributes in their top layers that are then delegated to their encapsulated shadow dom within the discretion of their constructor. For this it seems like a new capability but I might be corrected. This is useful for resolving aria attributions top down to web components, but the main goal to achieve is the full cross-root aria challenge. For that, #916 might be the next stone. |
I believe that is already possible using code such as the following (referring to the example in the OP): class MyInput extends HTMLElement {
static observedAttributes = ["aria-label"];
#input;
constructor() {
super();
this.#input = document.createElement('input');
this.shadowRoot.appendChild(this.#input);
this.#input.ariaLabel = this.ariaLabel;
}
attributeChangedCallback(name, newValue, oldValue) {
if (name === "aria-label") {
this.#input.ariaLabel = this.ariaLabel;
}
}
} Can you spot anything that this proposal would enable that code like the above would not? It would be really helpful to understand the scope of the proposal to get a clear answer. |
I thought the main advantage was the attribute not applying to the host element when it's delegated. For instance when delegating Is that correct @dfreedm ? |
I'm working on a document on how this and 916 applies to my current use cases. I might be missing a point with this current solution vs what @domenic pointed out. I need time to investigate this and I hope to come in with a good conclusion on the following steps next week. |
That is correct! |
@domenic your example works with |
Feels like some of this is closed by https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md but there is deeper nuance that should continue to be discussed in the form of: #1068 |
Synopsis
The AOM group has been discussing a "delegation" API to allow for ARIA attributes and properties set on a webcomponent to be forwarded to elements inside of its shadowroot as a simpler solution to the issues raised in WICG/aom#169.
This mechanism will allow users to apply standard best practices for ARIA, and should solve a large margin of accessibility use cases. This API is most suited for one-to-one delegation, but should also work for one-to-many setups. There is no mechanism for directly relating two elements in different shadowroots together, but this will still be possible manually with the element reflection API.
The AOM group considered two very similar API proposals,
ElementInternals::delegate
andShadowRoot::delegate
. Both have the same syntax, but the group did not agree strongly on whetherElementInternals
orShadowRoot
was the "better" fit.Example
The
my-input
element delegates thearia-label
andaria-describedby
attributes, andariaLabel
andariaDescribedByElements
properties to an internalinput
element.Users of
my-input
can use either the attributes or properties as expected, and the internalinput
element will announce instead ofmy-input
.The text was updated successfully, but these errors were encountered: