RFR: JDK-8276800 Fix table headers in NumericShaper.html

Ludvig Janiuk duke at openjdk.java.net
Wed Nov 10 11:07:37 UTC 2021


On Tue, 9 Nov 2021 12:30:19 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> This change introduces no visual difference, but improves a11y.
>
>> To me, the table looks correct currently: _Arabic_ Unicode range serves as the title for both rows. I wonder how it's read by a screen reader: the original version and the updated version. What we should strive for is for clarity of the read table rather than blindly following the rule where each row should have a title, provided that the title is available in this particular case.
> 
> You may be right, the description of [`rowgroup`](https://html.spec.whatwg.org/dev/tables.html#attr-th-scope-rowgroup) keyword says such a header applies to all the cells in the group: _“The row group state means the header cell applies to all the remaining cells in the row group.”_
> 
>> You change the semantics of the table by moving the header to another column. The rendering should rather change too, otherwise visual representation becomes misleading.
> 
> Maybe a better way would be to make the second column a row column as you're suggesting but still keeping the existing row groups and changing the `scope` of the *Tai Tham* header cell to `rowgroup`: that is `<th scope="rowgroup">Tai Tham</th>`; and then for consistency with the rows above mark the second column with `<th scope="row">`.
> 
> Does it make any sense?
> 
> Is the third column a better candidate for the row header?

@aivanov-jdk Your comment about `<tbody>` made me dig deeper. This [article on MDN ](https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Advanced) gives guidance on this specific kind of tables.

Concerning `<tbody>`, quote (emphasis mine): 

> As your tables get a bit more complex in structure, it is useful to give them more structural definition. One clear way to do this is by using `<thead>`, `<tfoot>`, and `<tbody>`, which allow you to mark up a header, footer, and body section for the table.

> **These elements don't make the table any more accessible to screenreader users**, and don't result in any visual enhancement on their own. They are however very useful for styling and layout — acting as useful hooks for adding CSS to your table.

Based on this, I don't see a foundation for having several tbodies. Am I missing something?

Concerning rowgroups, quote:

> `scope` has two more possible values — `colgroup` and `rowgroup`. these are used for headings that sit over the top of multiple columns or rows. If you look back at the "Items Sold August 2016" table at the start of this section of the article, you'll see that the "Clothes" cell sits above the "Trousers", "Skirts", and "Dresses" cells. All of these cells should be marked up as headers (<th>), but "Clothes" is a heading that sits over the top and defines the other three subheadings. "Clothes" therefore should get an attribute of scope="colgroup", whereas the others would get an attribute of scope="col".

In our case, it seems most idiomatic to make both column one and two a header. I've pushed a version like that. I am running doccheck locally and it is giving zero errors.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6291



More information about the client-libs-dev mailing list