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

Unified Diff: chrome/browser/resources/chromeos/chromevox/common/chromevox.js

Issue 1137403003: Fix ChromeVox's detection of whether the current document has focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
Index: chrome/browser/resources/chromeos/chromevox/common/chromevox.js
diff --git a/chrome/browser/resources/chromeos/chromevox/common/chromevox.js b/chrome/browser/resources/chromeos/chromevox/common/chromevox.js
index 04c0bd36673cc89711223f085dbb9f4a50e18593..db20382a06ab570fa42197ec1f4209f701e5b685 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/chromevox.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/chromevox.js
@@ -275,3 +275,20 @@ function $(id) {
* @param {Array} tabs
*/
cvox.ChromeVox.injectChromeVoxIntoTabs = function(tabs) {};
+
+/**
+ * Returns whether the document has focus, taking into account whether
+ * it's hidden and also that if an iframe or webview element has focus,
+ * the focus is really inside that frame and not in this document.
+ * @return {boolean} True if the document has focus.
+ */
+cvox.ChromeVox.documentHasFocus = function() {
+ if (!document.hasFocus() || document.hidden) {
+ return false;
+ }
+ if (document.activeElement.tagName == 'IFRAME' ||
+ document.activeElement.tagName == 'WEBVIEW') {
+ return false;
+ }
+ return true;
+};

Powered by Google App Engine
This is Rietveld 408576698