On Mon, 24 Jun 2024 08:04:08 GMT, psoujany <d...@openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java
>>  line 341:
>> 
>>> 339:                 cell.addStyle(tabClass);
>>> 340:                 if (!matchFound) {
>>> 341:                     cell.put(HtmlAttr.ROLE, "row")
>> 
>> We now use [CSS Grid 
>> layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout) 
>> for tables. Unfortunately, this implies that we do not have HTML elements 
>> representing rows. Tables are represented by an unstructured stream of table 
>> cells. This means that 
>> [`role="cell"`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
>>  would probably be the right attribute to use here.
>> 
>> Once 
>> [Subgrid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Subgrid)
>>  is well enough supported in browsers (which may be soon), we will be able 
>> to introduce elements representing table rows.
>
> @hns 
> [role="cell"](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/cell_role)
>  should be used within row element. But the code here has row styles as 
> `col-first even-row-color` and `col-last even-row-color` and also tabindex 
> should be added to only widget role i.e, `role="row"`. In order to add 
> `role="cell"` and `role="row"` ARIA elements then we have to restructure the 
> existing code. Could you please suggest here.
> 
> **Current code generates docs as :**
> 
> <div class="col-first odd-row-color" role="row" tabindex="0">&nbsp;</div>
> <div class="col-last odd-row-color"><a href="some link">Some Link</a></div>
> </div>
> 
> 
> **To add roles row and cell, docs to be generated as :**
> 
> <div class="col-first" role="row">
> <div class="odd-row-color" role="cell"><a href="someLink">SomeLink</a></div>
> </div>
> <div class="col-last" role="row" tabindex="0">
> <div class="odd-row-color" role="cell">&nbsp;</div>
> </div>

The problem I see is that we do not currently have elements representing table 
rows. There is [a JBS issue](https://bugs.openjdk.org/browse/JDK-8288900) for 
this problem, and it looks like we might be able to solve it in the not too 
distant future, depending on browsers supporting the necessary CSS features.  
However, until we do have actual elements representing table rows, I can't see 
how it makes sense to use `role="row"` attributes on what is essentially a 
table cell, not a row.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17819#discussion_r1662673829

Reply via email to