Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1052)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 1101883002: Suppress value changed events on text fields/text areas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
index ca1563fd1232b800ab6d77d860c4491d2b6e34b9..927cdc6ef06eb132d4229d1cc011b0ab81f70d42 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -62,13 +62,13 @@ Background = function() {
alert: this.onEventDefault,
focus: this.onEventDefault,
hover: this.onEventDefault,
+ loadComplete: this.onLoadComplete,
menuStart: this.onEventDefault,
menuEnd: this.onEventDefault,
menuListValueChanged: this.onEventDefault,
- loadComplete: this.onLoadComplete,
textChanged: this.onTextOrTextSelectionChanged,
textSelectionChanged: this.onTextOrTextSelectionChanged,
- valueChanged: this.onEventDefault
+ valueChanged: this.onValueChanged
};
// Register listeners for ...
@@ -320,6 +320,28 @@ Background.prototype = {
},
/**
+ * Provides all feedback once a value changed event fires.
+ * @param {Object} evt
+ */
+ onValueChanged: function(evt) {
+ // Don't process nodes inside of web content if ChromeVox Next is inactive.
+ if (evt.target.root.role != chrome.automation.RoleType.desktop &&
+ !this.active_)
+ return;
+
+ if (!evt.target.state.focused)
+ return;
+
+ // Value change events fire on web text fields and text areas when pressing
+ // enter; suppress them.
+ if (!this.currentRange_ ||
+ evt.target.role != chrome.automation.RoleType.textField) {
+ this.onEventDefault(evt);
+ this.currentRange_ = cursors.Range.fromNode(evt.target);
+ }
+ },
+
+ /**
* Called when the automation tree is changed.
* @param {chrome.automation.TreeChange} treeChange
*/
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698