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

Unified Diff: chrome/browser/resources/chromeos/select_to_speak/select_to_speak_gdocs_script.js

Issue 2795633002: Make select-to-speak work with Google Docs. (Closed)
Patch Set: Add manual test Created 3 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
Index: chrome/browser/resources/chromeos/select_to_speak/select_to_speak_gdocs_script.js
diff --git a/chrome/browser/resources/chromeos/select_to_speak/select_to_speak_gdocs_script.js b/chrome/browser/resources/chromeos/select_to_speak/select_to_speak_gdocs_script.js
new file mode 100644
index 0000000000000000000000000000000000000000..144c53f4feaf93e93bac0dea330e9c5512440b9a
--- /dev/null
+++ b/chrome/browser/resources/chromeos/select_to_speak/select_to_speak_gdocs_script.js
@@ -0,0 +1,24 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var tries = 10;
+
+// Google Docs isn't compatible with Select-to-speak by default because
+// in order to provide screen reader support, most of the rendered
+// document has aria-hidden set on it, which has the side effect of
+// hiding it from Select-to-speak too. Fix it by changing aria-hidden
+// to false. Try multiple times in case the page isn't fully loaded when
+// the content script runs.
+function RemoveAriaHiddenFromGoogleDocsContent() {
+ var element = document.querySelector('.kix-zoomdocumentplugin-outer');
+ if (element) {
+ element.setAttribute('aria-hidden', 'false');
+ } else {
+ tries--;
+ if (tries > 0)
+ window.setTimeout(RemoveAriaHiddenFromGoogleDocsContent, 1000);
+ }
+}
+
+RemoveAriaHiddenFromGoogleDocsContent();

Powered by Google App Engine
This is Rietveld 408576698