Commit cc7a3f52 authored by Abigail Klein's avatar Abigail Klein Committed by Commit Bot

[chrome:accessibility] Give feedback when the accessibility tree has

loaded.

AX-Relnotes: Give feedback when the accessibility tree has loaded on the
chrome:accessibility page.

Bug: 1082502
Change-Id: I4acacca12ed56b7e50af31c789aac300d939b845
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418973Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Abigail Klein <abigailbklein@google.com>
Cr-Commit-Position: refs/heads/master@{#808426}
parent a6445941
...@@ -207,7 +207,7 @@ cr.define('accessibility', function() { ...@@ -207,7 +207,7 @@ cr.define('accessibility', function() {
browsers.appendChild(row); browsers.appendChild(row);
} }
function formatRow(row, data) { function formatRow(row, data, requestType) {
if (!('url' in data)) { if (!('url' in data)) {
if ('error' in data) { if ('error' in data) {
row.appendChild(createErrorMessageElement(data)); row.appendChild(createErrorMessageElement(data));
...@@ -240,7 +240,8 @@ cr.define('accessibility', function() { ...@@ -240,7 +240,8 @@ cr.define('accessibility', function() {
row.appendChild(document.createTextNode(' | ')); row.appendChild(document.createTextNode(' | '));
const hasTree = 'tree' in data; const hasTree = 'tree' in data;
row.appendChild(createShowAccessibilityTreeElement(data, row.id, hasTree)); row.appendChild(
createShowAccessibilityTreeElement(data, row.id, requestType, hasTree));
if (navigator.clipboard) { if (navigator.clipboard) {
row.appendChild(createCopyAccessibilityTreeElement(data, row.id)); row.appendChild(createCopyAccessibilityTreeElement(data, row.id));
} }
...@@ -341,12 +342,18 @@ cr.define('accessibility', function() { ...@@ -341,12 +342,18 @@ cr.define('accessibility', function() {
return link; return link;
} }
function createShowAccessibilityTreeElement(data, id, opt_refresh) { function createShowAccessibilityTreeElement(
data, id, requestType, opt_refresh) {
const show = document.createElement('button'); const show = document.createElement('button');
if (opt_refresh) { if (requestType == 'showOrRefreshTree') {
// Give feedback that the tree has loaded.
show.textContent = 'Accessibility tree loaded';
setTimeout(() => {
show.textContent = 'Refresh accessibility tree'; show.textContent = 'Refresh accessibility tree';
}, 5000);
} else { } else {
show.textContent = 'Show accessibility tree'; show.textContent = opt_refresh ? 'Refresh accessibility tree' :
'Show accessibility tree';
} }
show.id = id + ':showOrRefreshTree'; show.id = id + ':showOrRefreshTree';
show.setAttribute('aria-expanded', String(opt_refresh)); show.setAttribute('aria-expanded', String(opt_refresh));
...@@ -420,7 +427,7 @@ cr.define('accessibility', function() { ...@@ -420,7 +427,7 @@ cr.define('accessibility', function() {
} }
row.textContent = ''; row.textContent = '';
formatRow(row, data); formatRow(row, data, 'showOrRefreshTree');
$(id + ':showOrRefreshTree').focus(); $(id + ':showOrRefreshTree').focus();
} }
......
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