|
22 | 22 | * or visit www.oracle.com if you need additional information or have any |
23 | 23 | * questions. |
24 | 24 | */ |
| 25 | +/* |
| 26 | + * =========================================================================== |
| 27 | + * (c) Copyright IBM Corp. 2025, 2025 All Rights Reserved |
| 28 | + * =========================================================================== |
| 29 | + */ |
25 | 30 |
|
26 | 31 | package jdk.javadoc.internal.doclets.formats.html; |
27 | 32 |
|
|
33 | 38 | import java.util.List; |
34 | 39 | import java.util.Set; |
35 | 40 | import java.util.function.Predicate; |
| 41 | +import java.util.regex.Pattern; |
36 | 42 |
|
37 | 43 | import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyles; |
38 | 44 | import jdk.javadoc.internal.html.Content; |
@@ -322,14 +328,25 @@ public void addRow(T item, List<Content> contents) { |
322 | 328 | } |
323 | 329 | } |
324 | 330 | int colIndex = 0; |
| 331 | + String regex = "<(?:a|area|button|input|object|select|textarea)\\b"; |
| 332 | + Pattern pattern = Pattern.compile(regex); |
325 | 333 | for (Content c : contents) { |
326 | 334 | HtmlStyle cellStyle = columnStyles.get(colIndex); |
327 | 335 | // Always add content to make sure the cell isn't dropped |
328 | 336 | var cell = HtmlTree.DIV(cellStyle).addUnchecked(c.isEmpty() ? Text.EMPTY : c); |
| 337 | + boolean matchFound = c.isEmpty() || pattern.matcher(c.toString()).find(); |
329 | 338 | cell.addStyle(rowStyle); |
| 339 | + if (!matchFound) { |
| 340 | + cell.put(HtmlAttr.ROLE, "tablist") |
| 341 | + .put(HtmlAttr.TABINDEX, "0"); |
| 342 | + } |
330 | 343 |
|
331 | 344 | for (String tabClass : tabClasses) { |
332 | 345 | cell.addStyle(tabClass); |
| 346 | + if (!matchFound) { |
| 347 | + cell.put(HtmlAttr.ROLE, "tablist") |
| 348 | + .put(HtmlAttr.TABINDEX, "0"); |
| 349 | + } |
333 | 350 | } |
334 | 351 | row.add(cell); |
335 | 352 | colIndex++; |
|
0 commit comments