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

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

Issue 1953913002: Revise accessibility for Date/TimeView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skip_ancestor
Patch Set: Created 4 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/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 f9768fa3c9c2e5c973541a25bc1f4bd5aaf6274a..ffcf394d5830f59385781d7f78cabd8aaa8d6124 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -635,11 +635,29 @@ Background.prototype = {
cvox.QueueMode.FLUSH);
return false;
case 'speakTimeAndDate':
- var output = new Output();
- var dateTime = new Date();
- output.withString(
- dateTime.toLocaleTimeString() +
- ', ' + dateTime.toLocaleDateString()).go();
+ chrome.automation.getDesktop(function(d) {
+ // First, try speaking the on-screen time.
+ var allTime = d.findAll({role: RoleType.time});
dmazzoni 2016/05/06 15:53:14 Not for this change, but I think it'd be useful if
David Tseng 2016/05/06 20:40:14 Agreed; in this case, it would involve a leaf pred
+ allTime.filter(function(t) {
+ return t.root.role == RoleType.desktop;
+ });
+
+ var timeString = '';
+ allTime.forEach(function(t) {
+ if (t.name)
+ timeString = t.name;
+ });
+ if (timeString) {
+ cvox.ChromeVox.tts.speak(timeString, cvox.QueueMode.FLUSH);
+ } else {
+ // Fallback to the old way of speaking time.
+ var output = new Output();
+ var dateTime = new Date();
+ output.withString(
+ dateTime.toLocaleTimeString() +
+ ', ' + dateTime.toLocaleDateString()).go();
+ }
+ });
return false;
case 'readCurrentTitle':
var target = this.currentRange_.start.node;

Powered by Google App Engine
This is Rietveld 408576698