Commit 6d779287 authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

Navi: Add accessibility announcements for Google apps module.

This makes screen reader users aware that we've created bookmarks.

R=scottchen@chromium.org

Bug: 881937
Change-Id: I36f246768d6dfbf631860d1da0c043a6b7d20781
Reviewed-on: https://chromium-review.googlesource.com/c/1302494
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604060}
parent 884da029
...@@ -13,9 +13,15 @@ ...@@ -13,9 +13,15 @@
<message name="IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED" desc="String read for accessibility to inform the user a bookmark was added."> <message name="IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED" desc="String read for accessibility to inform the user a bookmark was added.">
Bookmark added Bookmark added
</message> </message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARKS_ADDED" desc="String read for accessibility to inform the user that several bookmarks were added.">
Bookmarks added
</message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED" desc="String read for accessibility to inform the user a bookmark was removed."> <message name="IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED" desc="String read for accessibility to inform the user a bookmark was removed.">
Bookmark removed Bookmark removed
</message> </message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARKS_REMOVED" desc="String read for accessibility to inform the user that several bookmarks were removed.">
Bookmarks removed
</message>
<message name="IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED" desc="String read for accessibility to inform the user a bookmark was replaced."> <message name="IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED" desc="String read for accessibility to inform the user a bookmark was replaced.">
Bookmark replaced Bookmark replaced
</message> </message>
......
...@@ -14,7 +14,9 @@ js_type_check("closure_compile") { ...@@ -14,7 +14,9 @@ js_type_check("closure_compile") {
js_library("apps_chooser") { js_library("apps_chooser") {
deps = [ deps = [
"../shared:bookmark_proxy", "../shared:bookmark_proxy",
"//third_party/polymer/v1_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer-extracted",
"//ui/webui/resources/js:cr", "//ui/webui/resources/js:cr",
"//ui/webui/resources/js:i18n_behavior",
] ]
} }
......
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
<link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html"> <link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://welcome/google_apps/nux_google_apps_proxy.html"> <link rel="import" href="chrome://welcome/google_apps/nux_google_apps_proxy.html">
<link rel="import" href="chrome://welcome/shared/chooser_shared_css.html">
<link rel="import" href="chrome://welcome/shared/bookmark_proxy.html"> <link rel="import" href="chrome://welcome/shared/bookmark_proxy.html">
<link rel="import" href="chrome://welcome/shared/chooser_shared_css.html">
<dom-module id="apps-chooser"> <dom-module id="apps-chooser">
<template> <template>
......
...@@ -27,6 +27,8 @@ nuxGoogleApps.AppItemModel; ...@@ -27,6 +27,8 @@ nuxGoogleApps.AppItemModel;
Polymer({ Polymer({
is: 'apps-chooser', is: 'apps-chooser',
behaviors: [I18nBehavior],
properties: { properties: {
/** /**
* @type {!Array<!nuxGoogleApps.AppItem>} * @type {!Array<!nuxGoogleApps.AppItem>}
...@@ -49,6 +51,13 @@ Polymer({ ...@@ -49,6 +51,13 @@ Polymer({
/** @private {nux.BookmarkProxy} */ /** @private {nux.BookmarkProxy} */
bookmarkProxy_: null, bookmarkProxy_: null,
/** @override */
attached: function() {
Polymer.RenderStatus.afterNextRender(this, () => {
Polymer.IronA11yAnnouncer.requestAvailability();
});
},
/** @override */ /** @override */
ready() { ready() {
this.appsProxy_ = nux.NuxGoogleAppsProxyImpl.getInstance(); this.appsProxy_ = nux.NuxGoogleAppsProxyImpl.getInstance();
...@@ -65,19 +74,27 @@ Polymer({ ...@@ -65,19 +74,27 @@ Polymer({
app.selected = true; app.selected = true;
this.updateBookmark(app); this.updateBookmark(app);
}); });
this.updateHasAppsSelected();
this.fire('iron-announce', {text: this.i18n('bookmarksAdded')});
}); });
} }
}, },
/** Called when bookmarks should be removed for all selected apps. */ /** Called when bookmarks should be removed for all selected apps. */
removeAllBookmarks() { removeAllBookmarks() {
let removedBookmarks = false;
this.appList_.forEach(app => { this.appList_.forEach(app => {
if (app.selected) { if (app.selected) {
app.selected = false; app.selected = false;
this.updateBookmark(app); this.updateBookmark(app);
removedBookmarks = true;
} }
}); });
// Only update and announce if we removed bookmarks.
if (removedBookmarks) {
this.updateHasAppsSelected(); this.updateHasAppsSelected();
this.fire('iron-announce', {text: this.i18n('bookmarksRemoved')});
}
}, },
/** /**
...@@ -114,6 +131,12 @@ Polymer({ ...@@ -114,6 +131,12 @@ Polymer({
e.model.set('item.selected', !item.selected); e.model.set('item.selected', !item.selected);
this.updateBookmark(item); this.updateBookmark(item);
this.updateHasAppsSelected(); this.updateHasAppsSelected();
// Announcements should NOT be in |updateBookmark| because there should be a
// different utterance when all app bookmarks are added/removed.
if (item.selected)
this.fire('iron-announce', {text: this.i18n('bookmarkAdded')});
else
this.fire('iron-announce', {text: this.i18n('bookmarkRemoved')});
}, },
/** /**
......
...@@ -57,7 +57,9 @@ void AddOnboardingStrings(content::WebUIDataSource* html_source) { ...@@ -57,7 +57,9 @@ void AddOnboardingStrings(content::WebUIDataSource* html_source) {
// Shared strings. // Shared strings.
{"acceptText", IDS_WELCOME_ACCEPT_BUTTON}, {"acceptText", IDS_WELCOME_ACCEPT_BUTTON},
{"bookmarkAdded", IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED}, {"bookmarkAdded", IDS_ONBOARDING_WELCOME_BOOKMARK_ADDED},
{"bookmarksAdded", IDS_ONBOARDING_WELCOME_BOOKMARKS_ADDED},
{"bookmarkRemoved", IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED}, {"bookmarkRemoved", IDS_ONBOARDING_WELCOME_BOOKMARK_REMOVED},
{"bookmarksRemoved", IDS_ONBOARDING_WELCOME_BOOKMARKS_REMOVED},
{"bookmarkReplaced", IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED}, {"bookmarkReplaced", IDS_ONBOARDING_WELCOME_BOOKMARK_REPLACED},
{"getStarted", IDS_ONBOARDING_WELCOME_GET_STARTED}, {"getStarted", IDS_ONBOARDING_WELCOME_GET_STARTED},
{"headerText", IDS_WELCOME_HEADER}, {"headerText", IDS_WELCOME_HEADER},
......
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