Simplify ChromeVox rich text options UI
Expose a single checkbox that toggles reporting of all supported
rich text attributes, instead of providing a dropdown for each one.
This helps provide a cleaner experience that doesn't overwhelm the
user with excess options.
Bug: 934038
Change-Id: I3a6c539ddc9571de816658194b9d0a13685c9303
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1577953
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: Akihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653886}
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html
index 12c224a8..026e0c36 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html
@@ -98,52 +98,14 @@
</label>
</div>
- <div id="richTextIndicationOptions">
+ <div id="richTextIndicationOption">
<h2 class="i18n" msgid="options_rich_text_header">Rich Text Attributes</h2>
<div class="option">
- <input id="customizeRichTextIndication" type="checkbox" class="checkbox pref" name="customizeRichTextIndication">
- <label for="customizeRichTextIndication" class="i18n" msgid="options_rich_text_checkbox_label">
- Customize Rich text indication
+ <input id="announceRichTextAttributes" type="checkbox" class="checkbox pref" name="announceRichTextAttributes">
+ <label for="announceRichTextAttributes" class="i18n" msgid="options_rich_text_checkbox_label">
+ Announce rich text attributes
</label>
</div>
- <div id="additionalRichTextIndicationOptions">
- <div class="option">
- <span class="i18n description" msgid="options_misspell_description" id="misspellDescription">
- Indicate misspell:
- </span>
- <select id="indicateMisspell" aria-labelledby="misspellDescription" name="indicateMisspell">
- <option class="i18n" msgid="rich_text_do_nothing">Do nothing</option>
- <option class="i18n" msgid="rich_text_announce">Announce</option>
- </select>
- </div>
- <div class="option">
- <span class="i18n description" msgid="options_bold_description" id="boldDescription">
- Indicate bold:
- </span>
- <select id="indicateBold" aria-labelledby="boldDescription" name="indicateBold">
- <option class="i18n" msgid="rich_text_do_nothing">Do nothing</option>
- <option class="i18n" msgid="rich_text_announce">Announce</option>
- </select>
- </div>
- <div class="option">
- <span class="i18n description" msgid="options_italic_description" id="italicDescription">
- Indicate italic:
- </span>
- <select id="indicateItalic" aria-labelledby="italicDescription" name="indicateItalic">
- <option class="i18n" msgid="rich_text_do_nothing">Do nothing</option>
- <option class="i18n" msgid="rich_text_announce">Announce</option>
- </select>
- </div>
- <div class="option">
- <span class="i18n description" msgid="options_underline_description" id="underlineDescription">
- Indicate underline:
- </span>
- <select id="indicateUnderline" aria-labelledby="underlineDescription" name="indicateUnderline">
- <option class="i18n" msgid="rich_text_do_nothing">Do nothing</option>
- <option class="i18n" msgid="rich_text_announce">Announce</option>
- </select>
- </div>
- </div>
</div>
<h2 class="chromeos i18n" msgid="options_braille">Braille</h2>
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
index 8a22b74..5dfc0e4 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
@@ -63,7 +63,6 @@
cvox.OptionsPage.consoleTts =
chrome.extension.getBackgroundPage().ConsoleTts.getInstance();
cvox.OptionsPage.populateVoicesSelect();
- cvox.OptionsPage.populateRichTextSelects();
cvox.BrailleTable.getAll(function(tables) {
/** @type {!Array<cvox.BrailleTable.Table>} */
cvox.OptionsPage.brailleTables = tables;
@@ -114,21 +113,10 @@
'enable-experimental-accessibility-chromevox-rich-text-indication',
function(enabled) {
if (!enabled) {
- $('richTextIndicationOptions').style.display = 'none';
+ $('richTextIndicationOption').style.display = 'none';
}
});
- if (localStorage['customizeRichTextIndication'] === 'false')
- $('additionalRichTextIndicationOptions').style.display = 'none';
-
- // Toggle visibility of additional rich text options.
- $('customizeRichTextIndication').addEventListener('change', function(evt) {
- if (!evt.target.checked)
- $('additionalRichTextIndicationOptions').style.display = 'none';
- else
- $('additionalRichTextIndicationOptions').style.display = 'block';
- });
-
var registerEventStreamFiltersListener = function() {
$('toggle-event-stream-filters').addEventListener('click', function(evt) {
if ($('event-stream-filters').hidden) {
@@ -562,22 +550,3 @@
window.addEventListener('beforeunload', function(e) {
cvox.OptionsPage.bluetoothBrailleDisplayUI.detach();
});
-
-/**
- * Populates rich text selects with options.
- */
-cvox.OptionsPage.populateRichTextSelects = function() {
- var richTextSelects = [
- $('indicateMisspell'), $('indicateBold'), $('indicateItalic'),
- $('indicateUnderline')
- ];
- richTextSelects.forEach(function(select) {
- select.value = localStorage[select.id];
-
- select.addEventListener('change', function(evt) {
- var id = evt.target.id;
- var value = evt.target.options[evt.target.selectedIndex].value;
- cvox.OptionsPage.prefs.setPref(id, value);
- }, true);
- });
-};
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js
index 4148f15..73c7b66e 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js
@@ -63,6 +63,7 @@
cvox.ChromeVoxPrefs.DEFAULT_PREFS = {
'active': true,
'announceDownloadNotifications': true,
+ 'announceRichTextAttributes': true,
'audioStrategy': 'audioNormal',
'autoRead': false,
'brailleCaptions': false,
@@ -74,7 +75,6 @@
// class to manage multiple key maps. Also, this doesn't belong as a pref;
// should just store in local storage.
'currentKeyMap': cvox.KeyMap.DEFAULT_KEYMAP,
- 'customizeRichTextIndication': false,
'cvoxKey': '',
'enableBrailleLogging': false,
'enableEarconLogging': false,
@@ -97,11 +97,6 @@
'useClassic': false,
'useVerboseMode': true,
- 'indicateMisspell': 'do nothing',
- 'indicateBold': 'do nothing',
- 'indicateItalic': 'do nothing',
- 'indicateUnderline': 'do nothing',
-
// eventStreamFilters
'activedescendantchanged': true,
'alert': true,
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
index 417f625..ec65766 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -458,7 +458,8 @@
this.speakTextMarker_(container.markerTypes[markerEndIndex], true);
}
- this.speakTextStyle_(container);
+ if (localStorage['announceRichTextAttributes'] == 'true')
+ this.speakTextStyle_(container);
return;
}
@@ -674,18 +675,15 @@
msgs.push(
this.superscript_ ? {msg: 'superscript'} : {msg: 'not_superscript'});
}
- if ((localStorage['indicateBold'].toLowerCase() == 'announce') &&
- (bold !== this.bold_)) {
+ if (bold !== this.bold_) {
this.bold_ = bold;
msgs.push(this.bold_ ? {msg: 'bold'} : {msg: 'not_bold'});
}
- if ((localStorage['indicateItalic'].toLowerCase() == 'announce') &&
- (italic !== this.italic_)) {
+ if (italic !== this.italic_) {
this.italic_ = italic;
msgs.push(this.italic_ ? {msg: 'italic'} : {msg: 'not_italic'});
}
- if ((localStorage['indicateUnderline'].toLowerCase() == 'announce') &&
- (underline !== this.underline_)) {
+ if (underline !== this.underline_) {
this.underline_ = underline;
msgs.push(this.underline_ ? {msg: 'underline'} : {msg: 'not_underline'});
}
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
index 0c1f0fe..8ad4fd3e2 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
@@ -139,11 +139,7 @@
TEST_F('ChromeVoxEditingTest', 'RichTextMoveByLine', function() {
// Turn on rich text output settings.
- localStorage['customizeRichTextIndication'] = 'true';
- localStorage['indicateMisspell'] = 'announce';
- localStorage['indicateBold'] = 'announce';
- localStorage['indicateItalic'] = 'announce';
- localStorage['indicateUnderline'] = 'announce';
+ localStorage['announceRichTextAttributes'] = 'true';
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(function() {/*!
@@ -195,11 +191,7 @@
TEST_F('ChromeVoxEditingTest', 'RichTextMoveByCharacter', function() {
// Turn on rich text output settings.
- localStorage['customizeRichTextIndication'] = 'true';
- localStorage['indicateMisspell'] = 'announce';
- localStorage['indicateBold'] = 'announce';
- localStorage['indicateItalic'] = 'announce';
- localStorage['indicateUnderline'] = 'announce';
+ localStorage['announceRichTextAttributes'] = 'true';
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(function() {/*!
@@ -271,8 +263,10 @@
});
});
-// Flakily times out. crbug.com/942241
-TEST_F('ChromeVoxEditingTest', 'DISABLED_RichTextMoveByCharacterAllAttributes', function() {
+TEST_F('ChromeVoxEditingTest', 'RichTextMoveByCharacterAllAttributes', function() {
+ // Turn on rich text output settings.
+ localStorage['announceRichTextAttributes'] = 'true';
+
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(function() {/*!
<div role="textbox" contenteditable>
@@ -498,11 +492,7 @@
TEST_F('ChromeVoxEditingTest', 'RichTextLinkOutput', function() {
// Turn on rich text output settings.
- localStorage['customizeRichTextIndication'] = 'true';
- localStorage['indicateMisspell'] = 'announce';
- localStorage['indicateBold'] = 'announce';
- localStorage['indicateItalic'] = 'announce';
- localStorage['indicateUnderline'] = 'announce';
+ localStorage['announceRichTextAttributes'] = 'true';
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(function() {/*!