Skip to content

Commit

Permalink
8311893: Interactive component with ARIA role 'tabpanel' does not hav…
Browse files Browse the repository at this point in the history
…e a programmatically associated name

Reviewed-by: hannesw
Backport-of: 783ae56634a3bca23516c22b071d224fec18591f
  • Loading branch information
psoujany authored and Paul Hohensee committed Feb 29, 2024
1 parent 2b34eeb commit 85a49ed
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ private Content toContent() {

int tabIndex = 0;
tablist.add(createTab(HtmlIds.forTab(id, tabIndex), activeTabStyle, true, defaultTab));
table.put(HtmlAttr.ARIA_LABELLEDBY, HtmlIds.forTab(id, tabIndex).name());
for (Content tabLabel : tabMap.keySet()) {
tabIndex++;
if (tabs.contains(tabLabel)) {
Expand All @@ -415,7 +414,8 @@ private Content toContent() {
}
HtmlTree tabpanel = new HtmlTree(TagName.DIV)
.setId(HtmlIds.forTabPanel(id))
.put(HtmlAttr.ROLE, "tabpanel");
.put(HtmlAttr.ROLE, "tabpanel")
.put(HtmlAttr.ARIA_LABELLEDBY, HtmlIds.forTab(id, 0).name());
table.add(getTableBody());
tabpanel.add(table);
main.add(tablist);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function show(tableId, selected, columns) {
}

function updateTabs(tableId, selected) {
document.querySelector('div#' + tableId +' .summary-table')
document.getElementById(tableId + '.tabpanel')
.setAttribute('aria-labelledby', selected);
document.querySelectorAll('button[id^="' + tableId + '"]')
.forEach(function(tab, index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void test() {
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">""",
"""
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">""");
<div class="summary-table three-column-summary">""");

checkOutput("pkg1/package-summary.html", true,
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,24 @@ void checkHtmlTableTag() {
//Package summary
checkOutput("pkg1/package-summary.html", true,
"""
<div class="summary-table two-column-summary" aria-labelledby="class-summary-tab0">""");
<div class="summary-table two-column-summary">""");

checkOutput("pkg2/package-summary.html", true,
"""
<div class="summary-table two-column-summary" aria-labelledby="class-summary-tab0">""");
<div class="summary-table two-column-summary">""");

// Class documentation
checkOutput("pkg1/C1.html", true,
"""
<div class="summary-table three-column-summary">""",
"""
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">""");
<div class="summary-table three-column-summary">""");

checkOutput("pkg2/C2.html", true,
"""
<div class="summary-table three-column-summary">""",
"""
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">""");
<div class="summary-table three-column-summary">""");

checkOutput("pkg2/C2.ModalExclusionType.html", true,
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void html5Output() {
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
""",
"""
<div class="summary-table two-column-summary" aria-labelledby="class-summary-tab0">""",
<div class="summary-table two-column-summary">""",
"""
<header role="banner" class="flex-header">
<nav role="navigation">
Expand Down Expand Up @@ -413,7 +413,7 @@ void html5Output() {
<div class="caption"><span>Enum Constants</span></div>
""",
"""
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
""",
"""
<section class="method-summary" id="method-summary">
Expand Down Expand Up @@ -454,7 +454,7 @@ void html5Output() {
<div id="method-summary-table">
""",
"""
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
""",
"""
<section class="method-details" id="method-detail">
Expand Down
10 changes: 5 additions & 5 deletions test/langtools/jdk/javadoc/doclet/testModules/TestModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,8 @@ void checkGroupOption() {
ck="show('all-modules-table', 'all-modules-table-tab3', 2)" class="table-tab">Ot\
her Modules</button>\
</div>
<div id="all-modules-table.tabpanel" role="tabpanel">
<div class="summary-table two-column-summary" aria-labelledby="all-modules-table-tab0">""",
<div id="all-modules-table.tabpanel" role="tabpanel" aria-labelledby="all-modules-table-tab0">
<div class="summary-table two-column-summary">""",
"""
var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
Expand Down Expand Up @@ -1269,8 +1269,8 @@ void checkUnnamedModuleGroupOption() {
ck="show('all-packages-table', 'all-packages-table-tab2', 2)" class="table-tab">P\
ackage Group 1</button>\
</div>
<div id="all-packages-table.tabpanel" role="tabpanel">
<div class="summary-table two-column-summary" aria-labelledby="all-packages-table-tab0">""",
<div id="all-packages-table.tabpanel" role="tabpanel" aria-labelledby="all-packages-table-tab0">
<div class="summary-table two-column-summary">""",
"""
var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
Expand Down Expand Up @@ -1423,7 +1423,7 @@ void checkAllPkgsAllClasses(boolean found) {
""");
checkOutput("allclasses-index.html", found,
"""
<div class="summary-table two-column-summary" aria-labelledby="all-classes-table-tab0">
<div class="summary-table two-column-summary">
""");
checkOutput("allpackages-index.html", found,
"""
Expand Down
Loading

1 comment on commit 85a49ed

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.