Skip to content
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

ARIA IDL updates: convert eligible attributes to enumerated, new ARIA IDL guidance and examples #2413

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

rahimabdi
Copy link
Contributor

@rahimabdi rahimabdi commented Jan 24, 2025

Closes #2281
Closes #2279

  • add enumerated attribute definitions for the following attributes including missing value default, invalid value default, keywords/states and canonical keyword:
    • aria-atomic
    • aria-autocomplete
    • aria-busy
    • aria-checked
    • aria-current
    • aria-disabled
    • aria-expanded
    • aria-haspopup
    • aria-hidden
    • aria-invalid
    • aria-live
    • aria-modal
    • aria-multiline
    • aria-multiselectable
    • aria-orientation
    • aria-pressed
    • aria-readonly
    • aria-required
    • aria-selected
    • aria-sort
  • Revise "A. Mapping WAI-ARIA Value types to languages" to include enumerated attributes
  • Revise "6.2.4 Value" for permissible values (remove all other types except "enumerated"?)
  • Update "6.3 ARIA Attributes"
    • Remove obsolete note in "6.3.4 ARIA nullable DOMString Attributes" about ARIA transitioning to non-nullable DOMString?
    • Remote spec guidance around getting/setting to only apply to non-enumerated attributes
    • Provide updated examples for "6.3.4.1 Example Attribute Usage"

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.


Preview | Diff

Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for wai-aria ready!

Name Link
🔨 Latest commit 509091f
🔍 Latest deploy log https://app.netlify.com/sites/wai-aria/deploys/67b2de791f08e600088e8a21
😎 Deploy Preview https://deploy-preview-2413--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 site configuration.

@rahimabdi rahimabdi changed the title ARIA IDL updates (adding keywords/states and missing/invalid values defaults) ARIA IDL updates: add keywords/states and missing/invalid values defaults for eligible attributes Feb 16, 2025
@rahimabdi rahimabdi changed the title ARIA IDL updates: add keywords/states and missing/invalid values defaults for eligible attributes ARIA IDL updates: convert eligible attributes to enumerated Feb 17, 2025
@rahimabdi rahimabdi changed the title ARIA IDL updates: convert eligible attributes to enumerated ARIA IDL updates: convert eligible attributes to enumerated, update IDL guidance and examples Feb 17, 2025
@rahimabdi rahimabdi changed the title ARIA IDL updates: convert eligible attributes to enumerated, update IDL guidance and examples ARIA IDL updates: convert eligible attributes to enumerated, new ARIA IDL guidance and examples Feb 17, 2025
@rahimabdi rahimabdi marked this pull request as ready for review February 19, 2025 00:14
@rahimabdi rahimabdi added Agenda and removed Agenda labels Feb 19, 2025
@rahimabdi rahimabdi marked this pull request as draft February 19, 2025 21:37
@rahimabdi rahimabdi marked this pull request as ready for review February 26, 2025 22:34
@rahimabdi
Copy link
Contributor Author

Adding this PR for discussion at the Feb 27 2025 ARIA WG meeting.

@cookiecrook cookiecrook self-requested a review February 26, 2025 23:08
@@ -99,10 +99,10 @@ caption{
margin:1em 0 0.1em;
padding:0 0 0 0.3em;
}
table.role-features th, table.role-features td, table.state-features th, table.state-features td, table.property-features th, table.property-features td, table.value-descriptions th, table.value-descriptions td {
table.role-features th, table.role-features td, table.state-features th, table.state-features td, table.property-features th, table.property-features td, table.value-descriptions th, table.value-descriptions td, table.state-descriptions th, table.state-descriptions td {
Copy link
Member

Choose a reason for hiding this comment

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

This change will cause a conflict with #2410. Could you use a respec class name instead?

Copy link
Member

Choose a reason for hiding this comment

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

FYI #2410 was merged - please undo this change when rebasing so we don't end up with "new" copy of common.css in the repository.

Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

@rahimabdi I've left a couple of review notes which I think apply in a lot of places, but rather than inundating you with review comments hopefully you can take the couple here and pattern match across the rest of the spec.

<td class="value-description">Assistive technologies will present the entire changed region as a whole, including the author-defined label if one exists.</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 Missing state.</p>
Copy link
Member

Choose a reason for hiding this comment

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

HTML has a concept of states that don't map to a keyword, but each state must have a definition, the definition allows mapping back to a keyword, or null. As an example the popover attribute has a missing value default of no-popover state which let's the spec say things like "if the popover attribute is in the no-popover state".

Additionally, traditional enumerated attributes will map an invalid state back to a particular keyword; for example popover's invalid attribute state is the manual state, which maps to the keyword "manual". It's important to know what the invalid state maps back to because it determines what value is returned in the IDL for those values.

Note: not all missing values return null (e.g. the kind attribute on <track> elements has a missing value default of the subtitles state, so a track's .kind property returns "subtitles" even if the attribute is not present, another example is the type attribute on <input> which defaults to "text").

With that said it's possible to be in "no state". In fact, an enumerated attribute without a missing value default will be in "no state", as will invalid. No state, AIUI, will always map to null.

So here, the simplest thing for us to do here, rather than the implied missing state is to remove this, and lean on the lack of a missing/invalid state returning the no state. IOW this line could simply be removed:

Suggested change
<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 Missing state.</p>

If you think missing the definitions create more ambiguity, then we can instead do something like:

Suggested change
<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 Missing state.</p>
<p>The attribute has no <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> or <a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a>.</p>

@@ -10826,6 +10849,7 @@ <h2>Definitions of States and Properties (all aria-* attributes)</h2>
</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>
Copy link
Member

Choose a reason for hiding this comment

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

The <tr> for the "undefined" keyword is missing a <th> to name its state. In other words there should be a line above L10848 with <th class="state-description" scope="row">Undefined</th>. (I cannot comment on L10848 sadly).

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:

Suggested change
<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> are both the Undefined state.</p>

</tr>
</tbody>
</table>
<table class="value-descriptions">
<caption>Values:</caption>
<thead>
<tr>
<th scope="col">Value</th>
<th scope="col">Value (keyword)</th>
<th scope="col">State</th>
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a mix of tabs/spaces here.

<td class="value-description">Indicates the popup is a <rref>dialog</rref>.</td>
</tr>
</tbody>
</table>
<p>The attribute's <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> is the Undefined state, and its <a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> is the Menu state.</p>
Copy link
Member

Choose a reason for hiding this comment

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

Again, here, the missing value default being the Undefined state means .ariaHasPopup will return "undefined" which I don't think is desirable. Instead:

Suggested change
<p>The attribute's <a data-cite="html/common-microsyntaxes.html#missing-value-default">missing value default</a> is the Undefined state, and its <a data-cite="html/common-microsyntaxes.html#invalid-value-default">invalid value default</a> is the Menu 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 Menu state.</p>

@spectranaut
Copy link
Contributor

Discussed briefly in today's ARIA meeting: https://www.w3.org/2025/03/06-aria-minutes#cd2e

@spectranaut spectranaut removed the Agenda label Mar 6, 2025
@pkra
Copy link
Member

pkra commented Mar 7, 2025

@rahimabdi I'm unable to help since this is on your fork. This looks like it will be a bit messy - very sorry!

@rahimabdi
Copy link
Contributor Author

@pkra Would it be easier to create a fresh branch from current main? I can re-do all of the updates and copy over the comments.

@pkra
Copy link
Member

pkra commented Mar 10, 2025

@pkra Would it be easier to create a fresh branch from current main? I can re-do all of the updates and copy over the comments.

@rahimabdi I suspect the answer is yes. Sorry again, also to @keithamus for creating additional review work.

@rahimabdi
Copy link
Contributor Author

@pkra No worries, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants