summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmazzoni <dmazzoni@chromium.org>2015-04-01 15:21:20 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-01 22:22:51 +0000
commit7325e77dfe9e47584f63233bd2aea1cb8412857a (patch)
tree6c8d571d78609776b9e7c9085804ef80cd8afd00
parent02a0aa23197f583bb8fa04b66655553f612ea269 (diff)
downloadchromium_src-7325e77dfe9e47584f63233bd2aea1cb8412857a.zip
chromium_src-7325e77dfe9e47584f63233bd2aea1cb8412857a.tar.gz
chromium_src-7325e77dfe9e47584f63233bd2aea1cb8412857a.tar.bz2
Don't announce clipboard events if the event target is not visible and focused.
Basically if any other event on that target wouldn't normally be announced by ChromeVox, we shouldn't announce clipboard events either. BUG=465939 Review URL: https://codereview.chromium.org/1040333004 Cr-Commit-Position: refs/heads/master@{#323342}
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js
index b4d3c7e..0603e39 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js
@@ -868,6 +868,16 @@ cvox.ChromeVoxEventWatcher.changeEventWatcher = function(evt) {
* @return {boolean} True if the default action should be performed.
*/
cvox.ChromeVoxEventWatcher.clipboardEventWatcher = function(evt) {
+ // Don't announce anything unless this document has focus and the
+ // editable element that's the target of the clipboard event is visible.
+ var targetNode = /** @type {Node} */(evt.target);
+ if (!document.hasFocus() ||
+ !targetNode ||
+ !cvox.DomUtil.isVisible(targetNode) ||
+ cvox.AriaUtil.isHidden(targetNode)) {
+ return true;
+ }
+
cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg(evt.type).toLowerCase(),
cvox.QueueMode.QUEUE);
var text = '';