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

added caption role to table example #1484

Closed
wants to merge 10 commits into from
Closed

Conversation

jongund
Copy link
Contributor

@jongund jongund commented Aug 2, 2020

Added caption role to the table example for issue #1482 and also updated list of roles, properties and states and the table regression test to include caption.

@jongund jongund linked an issue Aug 2, 2020 that may be closed by this pull request
@jongund jongund changed the title added caption tolr to table example added caption tole to table example Aug 2, 2020
@carmacleod
Copy link
Contributor

Hi @jongund.

Unfortunately the build is failing because the Nu checker doesn't recognize the caption role.
Not sure what we usually do about this - do we just ignore it?
Or do we open a "caption is valid in ARIA 1.2" issue against the Nu checker and wait for them to implement so the build can pass?

The build also seems to have a problem with the deleted 'use strict';.
The failure is "Use the global form of 'use strict' strict".
I don't know what that means - I hope you do?

@jongund
Copy link
Contributor Author

jongund commented Aug 3, 2020

@carmacleod
This may have been why the table example did not include the caption role when it was created.

@carmacleod
Copy link
Contributor

@jongund @jnurthen Do we need to wait until ARIA 1.2 is Rec before we open Nu checker issues for the new roles? i.e. caption is in for sure, right? I can open a Nu checker issue if we're absolutely certain it won't get pulled out?

@pkra pkra changed the title added caption tole to table example added caption role to table example Aug 3, 2020
@@ -42,7 +42,7 @@ <h2 id="ex_label">Example</h2>
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep ex_label" aria-label="Start of"></div>
<div id="ex1">
<div role="table" aria-label="Students" aria-describedby="students_table_desc">
Copy link
Contributor

Choose a reason for hiding this comment

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

According to our table naming guidance, the aria-describedby is superfluous on table elements if a caption is present. I assume this would be true if the the element is an ARIA caption as well.

@@ -121,6 +121,12 @@ <h2 id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
<td><code>div</code></td>
<td>Refers to the element that serves as the caption for the table.</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

This table row would need to be removed if aria-describedby is not needed.

<th scope="row"><code>caption</code></th>
<td></td>
<td><code>div</code></td>
<td>The element containing a description of the table contents.</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest wording consistent with other roles

Suggested change
<td>The element containing a description of the table contents.</td>
<td>Identifies the element as a caption for the table.</td>

@carmacleod
Copy link
Contributor

carmacleod commented Nov 2, 2020

@mcking65

According to our table naming guidance, the aria-describedby is superfluous on table elements if a caption is present. I assume this would be true if the element is an ARIA caption as well.

Actually, implicit labelling/describing with ARIA caption role has not been specified.

The ARIA spec for role="caption" says authors SHOULD use aria-labelledby to point to the ARIA caption, or they MAY use aria-describedby if there's already an aria-label[ledby].

The table naming guidance that you linked to is specifically about an HTML table element with an HTML caption element child. HTML-AAM specifies this relationship in its mapping for HTML caption element and the section on Accessible Name and Description Computation for HTML table element.

CORE-AAM maps the new caption role to platform roles, but it defers to ACCNAME for naming and describing.

So I think that if we were to specify implicit labelling/describing for the new ARIA caption role, it would need to go somewhere in ACCNAME. Maybe it could somehow be crammed into step 2D, or perhaps added as a new step after step 2D (step 2Dii anyone?), with words something like:

Otherwise, if the current node's role (e.g. table) provides a role (e.g. caption) that defines a text alternative, return that alternative in the form of a flat string.

We might also need to reword other parts of ACCNAME a bit here and there, for example name from author currently says:

name is generated from values provided by the author in explicit markup features such as the aria-label and aria-labelledby attribute, or a host language labeling mechanism, such as the alt or title attribute in HTML, or the desc element in SVG.

The ARIA spec for table would also need to mention the caption role somewhere (e.g. might need a new "Allowed Owned Elements:" characteristic that lists "caption" role). Other roles that can be named by a caption role, i.e. figure, grid, treegrid, would also need to mention caption - they currently don't.

Seems to me that this behavior is on the borderline between what user agents are willing and not willing to do. On the one hand, it only affects assistive technologies because it just provides another way to link up an accessible name or description. On the other hand, it further complicates the already complex ACCNAME algorithm.

I have a vague memory of the group discussing this in several ARIA WG calls, but I don't recall the conclusion. Might be all rolled into the "Name from legend" discussion, which I believe we still need to finalize before ARIA 1.3?

[Edit: I rediscovered @jongund's PR https://github.com/w3c/aria/pull/1020, which fixes up the caption & legend labelling techniques in the ARIA spec. At a quick glance, I think that PR addresses many of the points in this comment. If we get it finalized in the ARIA spec, we can then get the labelling techniques specified in ACCNAME so that browsers can understand what to implement.]

@jongund
Copy link
Contributor Author

jongund commented Nov 2, 2020

The value of the caption role is dubious at best, since most developers will think it provides some type of table naming or describing function without the need of for using aria-labelledby or aria-describedby. Just another reason we need authoring practices to help authors understand the differences (e.g. gotcha's) between named elements in HTML and ARIA roles with the same name in ARIA.

@jongund jongund closed this Dec 1, 2020
@zcorpan zcorpan deleted the add-caption-to-table branch May 31, 2021 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing caption in table example
3 participants