Commit f1914d03 authored by Yue Li's avatar Yue Li Committed by Commit Bot

Add aria-label for popup dialog in Assistant opt-in flow

Bug: 1024103
Test: Manual Test
Change-Id: I323573a32c3b3925e9840f1cabfe8029d5b5ac9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928195Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718320}
parent 3ea8e0d9
......@@ -78,16 +78,18 @@ Polymer({
}
e.preventDefault();
this.lastFocusedElement = e.target;
this.showThirdPartyOverlay(e.target.href);
this.showThirdPartyOverlay(e.target.href, e.target.innerText);
},
/**
* Shows third party information links in overlay dialog.
* @param {string} url URL to show.
* @param {string} title Title of the dialog.
*/
showThirdPartyOverlay: function(url) {
showThirdPartyOverlay: function(url, title) {
this.$['webview-container'].classList.add('overlay-loading');
this.$['overlay-webview'].src = url;
this.$['third-party-overlay'].setTitleAriaLabel(title);
this.$['third-party-overlay'].showModal();
this.$['overlay-close-button'].focus();
},
......
......@@ -164,6 +164,7 @@ Polymer({
this.sanitizer_.sanitizeHtml(title);
this.$['overlay-additional-info-text'].innerHTML =
this.sanitizer_.sanitizeHtml(additionalInfo);
this.$['learn-more-overlay'].setTitleAriaLabel(title);
this.$['learn-more-overlay'].showModal();
this.$['overlay-close-button'].focus();
......
......@@ -193,6 +193,15 @@ Polymer({
this.open = false;
},
/**
* Set the title of the dialog for a11y reader.
* @param {string} title Title of the dialog.
*/
setTitleAriaLabel: function(title) {
this.$.dialog.removeAttribute('aria-labelledby');
this.$.dialog.setAttribute('aria-label', title);
},
/**
* @private
* @param {Event} e
......
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