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 98cc4578abf5dd36e763d6b6e21916a269e6b04f..832456dd48f54ae4229dfbfff2960da67f46c364 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js |
@@ -78,7 +78,7 @@ Background = function() { |
* @type {!Object<EventType, function(Object) : void>} |
*/ |
this.listeners_ = { |
- alert: this.onEventDefault, |
+ alert: this.onAlert, |
focus: this.onFocus, |
hover: this.onEventDefault, |
loadComplete: this.onLoadComplete, |
@@ -454,6 +454,26 @@ Background.prototype = { |
}, |
/** |
+ * Makes an announcement without changing focus. |
+ * @param {Object} evt |
+ */ |
+ onAlert: function(evt) { |
+ var node = evt.target; |
+ if (!node) |
+ return; |
+ |
+ // Don't process nodes inside of web content if ChromeVox Next is inactive. |
+ if (node.root.role != RoleType.desktop && |
+ this.mode_ === ChromeVoxMode.CLASSIC) { |
+ return; |
+ } |
+ |
+ var range = cursors.Range.fromNode(node); |
+ |
+ new Output().withSpeechAndBraille(range, null, evt.type).go(); |
+ }, |
+ |
+ /** |
* Provides all feedback once a focus event fires. |
* @param {Object} evt |
*/ |