Commit c85a0c24 authored by Ian Barkley-Yeung's avatar Ian Barkley-Yeung Committed by Commit Bot

Accessibility: Skip empty table cells for system info subpage

Improve accessbility for system info subpage of Feedback by
marking empty cells in the table as aria-hidden. This really does
improve the navigation experience.

BUG=chromium:1005567
TEST=Ran system info under ChromeVox. Navigated around page, expanded
and collapsed sections, etc

Change-Id: I6397357552b6c4a78afaafc56a3fd1b4db5e8c1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869888Reviewed-by: default avatarJeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Commit-Queue: Ian Barkley-Yeung <iby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707971}
parent 6b362711
...@@ -41,6 +41,7 @@ function expand(button, valueDiv, delayFactor) { ...@@ -41,6 +41,7 @@ function expand(button, valueDiv, delayFactor) {
button.textContent = loadTimeData.getString('sysinfoPageCollapseBtn'); button.textContent = loadTimeData.getString('sysinfoPageCollapseBtn');
// Show the spinner container. // Show the spinner container.
const valueCell = valueDiv.parentNode; const valueCell = valueDiv.parentNode;
valueCell.removeAttribute('aria-hidden');
valueCell.firstChild.hidden = false; valueCell.firstChild.hidden = false;
// Expanding huge logs can take a very long time, so we do it after a delay // Expanding huge logs can take a very long time, so we do it after a delay
// to have a chance to render the spinner. // to have a chance to render the spinner.
...@@ -59,6 +60,9 @@ function expand(button, valueDiv, delayFactor) { ...@@ -59,6 +60,9 @@ function expand(button, valueDiv, delayFactor) {
function collapse(button, valueDiv) { function collapse(button, valueDiv) {
button.textContent = loadTimeData.getString('sysinfoPageExpandBtn'); button.textContent = loadTimeData.getString('sysinfoPageExpandBtn');
valueDiv.parentNode.className = 'number-collapsed'; valueDiv.parentNode.className = 'number-collapsed';
// Don't have screen readers announce the empty cell.
valueCell = valueDiv.parentNode;
valueCell.setAttribute('aria-hidden', 'true');
} }
/** /**
...@@ -122,9 +126,13 @@ function createButtonCell(key, isMultiLine) { ...@@ -122,9 +126,13 @@ function createButtonCell(key, isMultiLine) {
if (isMultiLine) { if (isMultiLine) {
const button = document.createElement('button'); const button = document.createElement('button');
button.setAttribute('id', '' + key + '-value-btn'); button.setAttribute('id', '' + key + '-value-btn');
button.setAttribute('aria-controls', '' + key + '-value');
button.onclick = changeCollapsedStatus; button.onclick = changeCollapsedStatus;
button.textContent = loadTimeData.getString('sysinfoPageExpandBtn'); button.textContent = loadTimeData.getString('sysinfoPageExpandBtn');
buttonCell.appendChild(button); buttonCell.appendChild(button);
} else {
// Don't have screen reader read the empty cell.
buttonCell.setAttribute('aria-hidden', 'true');
} }
return buttonCell; return buttonCell;
...@@ -143,6 +151,8 @@ function createValueCell(key, value, isMultiLine) { ...@@ -143,6 +151,8 @@ function createValueCell(key, value, isMultiLine) {
loadingContainer.setAttribute('id', '' + key + '-value-loading'); loadingContainer.setAttribute('id', '' + key + '-value-loading');
loadingContainer.hidden = true; loadingContainer.hidden = true;
valueCell.appendChild(loadingContainer); valueCell.appendChild(loadingContainer);
// Don't have screen readers read the empty cell.
valueCell.setAttribute('aria-hidden', 'true');
} else { } else {
valueCell.className = 'number'; valueCell.className = 'number';
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment