Skip to content

Commit

Permalink
[M74 Merge] Add a11y announces for Assistant voice match enrollment
Browse files Browse the repository at this point in the history
Bug: 939910
Test: Manual Test
Change-Id: If9a3975e63875f27d4e760e163b147df5dbdad1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1511735
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#640014}(cherry picked from commit c0fc7b7303a3f412705303bb6330b2dc588ab011)
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1521467
Reviewed-by: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/branch-heads/3729@{#93}
Cr-Branched-From: d4a8972-refs/heads/master@{#638880}
  • Loading branch information
Yue Li committed Mar 13, 2019
1 parent 968e6e8 commit dde5a3c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions chrome/app/chromeos_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -3173,6 +3173,9 @@
<message name="IDS_ASSISTANT_VOICE_MATCH_UPLOADING" desc="Uploading message for assistant voice match recording.">
Uploading...
</message>
<message name="IDS_ASSISTANT_VOICE_MATCH_ACCESSIBILITY_MESSAGE" desc="Instruction message for ChromeVox users while voice match recording.">
Please consider using headphones while training your voice
</message>
<message name="IDS_ASSISTANT_VOICE_MATCH_ALREADY_SETUP_TITLE" desc="Title for assistant voice match already setup.">
Your Assistant can already recognize your voice
</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Polymer({
listenForHotword: function() {
if (this.currentIndex_ == 0) {
this.fire('loaded');
announceAccessibleMessage(
loadTimeData.getString('assistantVoiceMatchRecording'));
announceAccessibleMessage(
loadTimeData.getString('assistantVoiceMatchA11yMessage'));
}
var currentEntry = this.$['voice-entry-' + this.currentIndex_];
currentEntry.setAttribute('active', true);
Expand All @@ -103,12 +107,19 @@ Polymer({
this.$['voice-match-entries'].hidden = true;
this.$['later-button'].hidden = true;
this.$['loading-animation'].hidden = false;
announceAccessibleMessage(
loadTimeData.getString('assistantVoiceMatchUploading'));
} else {
announceAccessibleMessage(
loadTimeData.getString('assistantVoiceMatchComplete'));
}
},

voiceMatchDone: function() {
this.removeClass_('recording');
this.fire('loaded');
announceAccessibleMessage(
loadTimeData.getString('assistantVoiceMatchCompleted'));
if (this.currentIndex_ != MAX_INDEX) {
// Existing voice model found on cloud. No need to train.
this.$['later-button'].hidden = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
$i18n{googleAssistantSettings}
</div>
<paper-icon-button-light class="icon-external">
<button></button>
<button aria-label="$i18n{googleAssistantSettings}"></button>
</paper-icon-button-light>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ void AssistantOptInFlowScreenHandler::DeclareLocalizedValues(
IDS_ASSISTANT_VOICE_MATCH_COMPLETE);
builder->Add("assistantVoiceMatchUploading",
IDS_ASSISTANT_VOICE_MATCH_UPLOADING);
builder->Add("assistantVoiceMatchA11yMessage",
IDS_ASSISTANT_VOICE_MATCH_ACCESSIBILITY_MESSAGE);
builder->Add("assistantVoiceMatchAlreadySetupTitle",
IDS_ASSISTANT_VOICE_MATCH_ALREADY_SETUP_TITLE);
builder->Add("assistantVoiceMatchAlreadySetupMessage",
Expand Down
2 changes: 1 addition & 1 deletion ui/webui/resources/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function announceAccessibleMessage(msg) {
document.body.appendChild(element);
window.setTimeout(function() {
document.body.removeChild(element);
}, 0);
}, 50);
}

/**
Expand Down

0 comments on commit dde5a3c

Please sign in to comment.