Commit d6b95cf0 authored by Hector Carmona's avatar Hector Carmona Committed by Commit Bot

A11y: Extensions: Announce when a keyboard shortcut is set.

Bug: 1031006
Change-Id: If119ab8748649e257385d88332a5037f3a4ab668
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954266Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722610}
parent 7f7d299f
...@@ -394,6 +394,9 @@ ...@@ -394,6 +394,9 @@
<message name="IDS_EXTENSIONS_TOOLBAR_UPDATING_TOAST" desc="Text displayed in a toast popup message while extensions are updating."> <message name="IDS_EXTENSIONS_TOOLBAR_UPDATING_TOAST" desc="Text displayed in a toast popup message while extensions are updating.">
Updating... Updating...
</message> </message>
<message name="IDS_EXTENSIONS_SHORTCUT_SET" desc="Text used to notify screen readers when a shortcut is successfully set.">
Shortcut set: <ph name="IDS_SHORT_SET_COMMAND">$1<ex>Ctrl + S</ex></ph>
</message>
<message name="IDS_EXTENSIONS_TYPE_A_SHORTCUT" desc="The prompt to the user to enter a keyboard shortcut in order to assign it to an extension."> <message name="IDS_EXTENSIONS_TYPE_A_SHORTCUT" desc="The prompt to the user to enter a keyboard shortcut in order to assign it to an extension.">
Type a shortcut Type a shortcut
</message> </message>
......
...@@ -533,7 +533,9 @@ js_library("shortcut_input") { ...@@ -533,7 +533,9 @@ js_library("shortcut_input") {
deps = [ deps = [
":keyboard_shortcut_delegate", ":keyboard_shortcut_delegate",
":shortcut_util", ":shortcut_util",
"//third_party/polymer/v3_0/components-chromium/iron-a11y-announcer:iron-a11y-announcer",
"//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior.m",
] ]
externs_list = [ "$externs_path/developer_private.js" ] externs_list = [ "$externs_path/developer_private.js" ]
} }
......
...@@ -9,6 +9,8 @@ import 'chrome://resources/cr_elements/hidden_style_css.m.js'; ...@@ -9,6 +9,8 @@ import 'chrome://resources/cr_elements/hidden_style_css.m.js';
import 'chrome://resources/polymer/v3_0/paper-styles/color.js'; import 'chrome://resources/polymer/v3_0/paper-styles/color.js';
import {assert} from 'chrome://resources/js/assert.m.js'; import {assert} from 'chrome://resources/js/assert.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {KeyboardShortcutDelegate} from './keyboard_shortcut_delegate.js'; import {KeyboardShortcutDelegate} from './keyboard_shortcut_delegate.js';
...@@ -28,6 +30,8 @@ Polymer({ ...@@ -28,6 +30,8 @@ Polymer({
_template: html`{__html_template__}`, _template: html`{__html_template__}`,
behaviors: [I18nBehavior],
properties: { properties: {
/** @type {!KeyboardShortcutDelegate} */ /** @type {!KeyboardShortcutDelegate} */
delegate: Object, delegate: Object,
...@@ -204,6 +208,11 @@ Polymer({ ...@@ -204,6 +208,11 @@ Polymer({
this.error_ = ShortcutError.NO_ERROR; this.error_ = ShortcutError.NO_ERROR;
IronA11yAnnouncer.requestAvailability();
this.fire('iron-announce', {
text: this.i18n('shortcutSet', this.computeText_()),
});
this.commitPending_(); this.commitPending_();
this.endCapture_(); this.endCapture_();
}, },
......
...@@ -235,6 +235,7 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile, ...@@ -235,6 +235,7 @@ content::WebUIDataSource* CreateMdExtensionsSource(Profile* profile,
{"shortcutScopeGlobal", IDS_EXTENSIONS_SHORTCUT_SCOPE_GLOBAL}, {"shortcutScopeGlobal", IDS_EXTENSIONS_SHORTCUT_SCOPE_GLOBAL},
{"shortcutScopeLabel", IDS_EXTENSIONS_SHORTCUT_SCOPE_LABEL}, {"shortcutScopeLabel", IDS_EXTENSIONS_SHORTCUT_SCOPE_LABEL},
{"shortcutScopeInChrome", IDS_EXTENSIONS_SHORTCUT_SCOPE_IN_CHROME}, {"shortcutScopeInChrome", IDS_EXTENSIONS_SHORTCUT_SCOPE_IN_CHROME},
{"shortcutSet", IDS_EXTENSIONS_SHORTCUT_SET},
{"shortcutTypeAShortcut", IDS_EXTENSIONS_TYPE_A_SHORTCUT}, {"shortcutTypeAShortcut", IDS_EXTENSIONS_TYPE_A_SHORTCUT},
{"shortcutIncludeStartModifier", IDS_EXTENSIONS_INCLUDE_START_MODIFIER}, {"shortcutIncludeStartModifier", IDS_EXTENSIONS_INCLUDE_START_MODIFIER},
{"shortcutTooManyModifiers", IDS_EXTENSIONS_TOO_MANY_MODIFIERS}, {"shortcutTooManyModifiers", IDS_EXTENSIONS_TOO_MANY_MODIFIERS},
......
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