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

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

Issue 2566253002: Merge to m56: Ensure spoken feedback keyboard hooks prevent re-injection of key up events (Closed)
Patch Set: Created 4 years 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/keyboard_handler.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/keyboard_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/keyboard_handler.js
index 8d4990f33f33e159adff7918c48b22f46f78dc87..2f3505ff4d343bc2242b372446e1556c182eabdd 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/keyboard_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/keyboard_handler.js
@@ -18,6 +18,9 @@ BackgroundKeyboardHandler = function() {
/** @type {number} @private */
this.passThroughKeyUpCount_ = 0;
+ /** @type {Set} @private */
+ this.eatenKeyDowns_ = new Set();
+
document.addEventListener('keydown', this.onKeyDown.bind(this), false);
document.addEventListener('keyup', this.onKeyUp.bind(this), false);
};
@@ -38,6 +41,7 @@ BackgroundKeyboardHandler.prototype = {
!cvox.ChromeVoxKbHandler.basicKeyDownActionsListener(evt)) {
evt.preventDefault();
evt.stopPropagation();
+ this.eatenKeyDowns_.add(evt.keyCode);
}
Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH);
return false;
@@ -59,6 +63,13 @@ BackgroundKeyboardHandler.prototype = {
this.passThroughKeyUpCount_++;
}
}
+
+ if (this.eatenKeyDowns_.has(evt.keyCode)) {
+ evt.preventDefault();
+ evt.stopPropagation();
+ this.eatenKeyDowns_.delete(evt.keyCode);
+ }
+
return false;
},
« 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