Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (c) Copyright IBM Corp. 2025, 2025 All Rights Reserved
* ===========================================================================
*/

package jdk.javadoc.internal.doclets.formats.html;

Expand All @@ -33,6 +38,7 @@
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.regex.Pattern;

import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyles;
import jdk.javadoc.internal.html.Content;
Expand Down Expand Up @@ -86,6 +92,7 @@ public class Table<T> extends Content {
private HtmlStyle gridStyle;
private final List<Content> bodyRows;
private HtmlId id;
private static final Pattern checkFormElements = Pattern.compile("<(?:a|area|button|input|object|select|textarea)\\b");

/**
* A record containing the data for a table tab.
Expand Down Expand Up @@ -326,10 +333,19 @@ public void addRow(T item, List<Content> contents) {
HtmlStyle cellStyle = columnStyles.get(colIndex);
// Always add content to make sure the cell isn't dropped
var cell = HtmlTree.DIV(cellStyle).addUnchecked(c.isEmpty() ? Text.EMPTY : c);
boolean matchFound = c.isEmpty() || checkFormElements.matcher(c.toString()).find();
cell.addStyle(rowStyle);
if (!matchFound) {
cell.put(HtmlAttr.ROLE, "tablist")
.put(HtmlAttr.TABINDEX, "0");
}
Comment on lines +338 to +341
Copy link
Member

Choose a reason for hiding this comment

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

This seems to apply to many more places than the title suggests - I don't think this is what we want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These values should be applied to all grid rows with/without tab elements which has only plain text.


for (String tabClass : tabClasses) {
cell.addStyle(tabClass);
if (!matchFound) {
cell.put(HtmlAttr.ROLE, "tablist")
.put(HtmlAttr.TABINDEX, "0");
}
Comment on lines +345 to +348
Copy link
Member

Choose a reason for hiding this comment

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

These lines are redundant; see lines 338-341.

Copy link
Contributor Author

@psoujany psoujany May 2, 2025

Choose a reason for hiding this comment

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

Yes Keith, here we have 2 styles.

  1. rowStyle without tabs : cell.addStyle(rowStyle); creates div as <div class="col-first even-row-color">
  2. rowStyle with tabs : cell.addStyle(tabClass); creates div as <div class="col-last odd-row-color all-classes-table all-classes-table-tab2">

For both the styles tab should get focus, to do that we need to add role=tablist tabindex=0.

}
row.add(cell);
colIndex++;
Expand Down