-
Notifications
You must be signed in to change notification settings - Fork 86
Add tabindex to all grid row elements(with/without tabs) which has only plain text to make it tabable. #997
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
base: openj9
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
||
|
|
@@ -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; | ||
|
|
@@ -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. | ||
|
|
@@ -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"); | ||
| } | ||
|
|
||
| for (String tabClass : tabClasses) { | ||
| cell.addStyle(tabClass); | ||
| if (!matchFound) { | ||
| cell.put(HtmlAttr.ROLE, "tablist") | ||
| .put(HtmlAttr.TABINDEX, "0"); | ||
| } | ||
|
Comment on lines
+345
to
+348
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These lines are redundant; see lines 338-341.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes Keith, here we have 2 styles.
For both the styles tab should get focus, to do that we need to add |
||
| } | ||
| row.add(cell); | ||
| colIndex++; | ||
|
|
||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.