-
Notifications
You must be signed in to change notification settings - Fork 133
ARIA IDL updates: enumerated attribute conversions, new "enumerated" wai-aria type, IDL examples #2484
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?
Conversation
✅ Deploy Preview for wai-aria ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
index.html
Outdated
<td class="value-description">The element does not support being checked.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p>The attribute's <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> and <a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> are both the Undefined state.</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.
Migrated comment from @keithamus (original):
I don't think we want the missing value default here to return the Undefined state, that will mean the .ariaChecked
property will return "undefined"
when aria-checked
isn't on the element. I presume we want to return null
instead? Browsers currently return null, so missing should be "no state", i.e. removed:
<p>The attribute's <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> and <a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> are both the Undefined state.</p> | |
<p>The attribute has no <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> and its <a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> is the Undefined state.</p> |
Thanks! I'll review those comments (which are migrated to this PR now) and respond. |
Re-added reviewers @pkra @spectranaut @cookiecrook @keithamus @scottaohara. |
… rahim/update-aria-idl-2025
CC @pkra @spectranaut @cookiecrook @keithamus @scottaohara @annevk This PR is ready for review! I've made a number of updates, mainly:
If helpful, I also created this tool to simulate how the new ARIA IDL works for enumerated attributes: https://rahimabdi.github.io/aria-idl-simulator/. |
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.
One thing that's nice in HTML is that all the states are a <dfn>
and therefore also can be linked. But maybe that's best addressed in a follow-up.
Some ARIA attributes support an Undefined state, which is equivalent to having no state (i.e., null). User agent implementations may omit the Undefined state since the lack of an explicit | ||
state results in the same behavior. For more information about determining the state of enumerated attributes, see |
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.
I think this sentence adds more confusion than it resolves. Especially since you cannot just leave it out at the moment without hitting an assert.
Default values from the ARIA values tables MUST NOT reflect to IDL as the <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> or the | ||
<a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> for the attribute. On getting, a missing ARIA attribute will return <code>null</code>. ARIA | ||
attributes are not validated on get. If an ARIA value is invalid, on getting, it will return its set value as a literal string, and will not return an invalid value default. | ||
For non-enumerated attributes, default values from the ARIA values tables MUST NOT reflect to IDL as 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 seems okay to state as a note, but it shouldn't be a requirement. HTML already requires this.
@@ -12761,7 +12802,7 @@ <h2>Definitions of States and Properties (all aria-* attributes)</h2> | |||
</tr> | |||
<tr> | |||
<th class="state-value-head" scope="row">Value:</th> | |||
<td class="state-value"><a href="#valuetype_tristate">tristate</a></td> | |||
<a href="#valuetype_enumerated">enumerated</a> |
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 seems better
<a href="#valuetype_enumerated">enumerated</a> | |
<td class="state-value"><a href="#valuetype_enumerated">enumerated</a></td> |
@aleventhal you may want to review this |
<td class="value-description"> | ||
When a user is providing input, an element containing a collection of values that could complete the provided input might be displayed. If displayed, one value in the collection is | ||
automatically selected, and the text needed to complete the automatically selected value appears after the caret in the input. | ||
</td> | ||
</tr> | ||
<tr> | ||
<th class="value-name" scope="row"><strong class="default">none (default)</strong></th> | ||
<th class="value-name" scope="row">none</th> |
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.
Is it intentional that (default)
is dropped here? (And in 18 other instances.)
Discussed in today's meeting: https://www.w3.org/2025/05/08-aria-minutes.html#7d9a |
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! this is much more clear, thank you
<p> | ||
For <a data-cite="html/common-dom-interfaces.html#reflect">reflection</a> purposes, the attribute's | ||
<a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> is the Undefined state (null) that has no associated keyword, and its | ||
<a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> is the False state. |
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.
(Blocking) So I believe this kind of change to the spec is web observable, which means it will need changes to the implementations and we need to ensure compatibility for web developers who may depend on the existing behaviour. Unless I am missing that somewhere we clarify that reflected enumerated properties should only return the value of the content attribute?
In this example the web observable piece is that the "invalid value default" is the False
state, which means that any invalid value would map to the False
(for which I presume the keyword is "false"
- see above).
This means pasting this HTML into your URL bar:
data:text/html,<body id=b><div id=d aria-atomic=foo><script>b.append(d.ariaAtomic)</script>
Should render false
on the page. But right now it renders foo
.
I think this will be the same for all of these properties, e.g. aria-autocomplete
, aria-checked
and so on.
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.
Right, we should have tests for this and such, but this is very much the motivation for making this change. This makes these IDL attributes more meaningful and enables them to be used for feature testing going forward.
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.
For sure, I appreciate the motivation for it, I just want us to be cautious about introducing changes to the spec without getting tests & approval from the various engines.
<td class="value-description">The element is checked.</td> | ||
</tr> | ||
<tr> | ||
<th class="value-name" scope="row"><strong class="default">undefined</strong> (default)</th> | ||
<th class="value-name" scope="row">undefined, empty string ("")</th> |
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.
(Non-blocking) We could reasonably drop the undefined
keyword here:
<th class="value-name" scope="row">undefined, empty string ("")</th> | |
<th class="value-name" scope="row">empty string ("")</th> |
If someone set "undefined"
then it would map to the invalid value default, which is the undefined state. The only reason not to do this is if you want the canonicalization steps to explicitly return undefined
rather than the empty string.
The same is true for other properties, e.g. aria-current
, and so on.
Closes #2281
Closes #2279
If helpful, I also created this tool to simulate how the new ARIA IDL works for enumerated attributes: https://rahimabdi.github.io/aria-idl-simulator/.
<strong>
style from old "defaults" valuesTest, 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.
Preview | Diff