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

Unified Diff: chrome/browser/resources/local_ntp/most_visited_util.js

Issue 544293002: [New Tab Page] Change which elements get focused during tab ordering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 years, 3 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/local_ntp/most_visited_util.js
diff --git a/chrome/browser/resources/local_ntp/most_visited_util.js b/chrome/browser/resources/local_ntp/most_visited_util.js
index 430917941438949c32dad5578af08ba5ce3c5e69..5cdd50cf8597fad429bad79d6132353589a2f00a 100644
--- a/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -123,15 +123,28 @@ function createMostVisitedLink(params, href, title, text, direction, provider) {
link.href = href;
link.title = title;
link.target = '_top';
- // Exclude links from the tab order. The tabIndex is added to the thumbnail
- // parent container instead.
- link.tabIndex = '-1';
+ // Include links in the tab order. The tabIndex is necessary for
+ // accessibility.
+ link.tabIndex = '0';
if (text)
link.textContent = text;
link.addEventListener('mouseover', function() {
var ntpApiHandle = chrome.embeddedSearch.newTabPage;
ntpApiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_MOUSEOVER);
});
+ link.addEventListener('focus', function() {
+ window.parent.postMessage('linkFocused', DOMAIN_ORIGIN);
+ });
+ link.addEventListener('blur', function() {
+ window.parent.postMessage('linkBlurred', DOMAIN_ORIGIN);
+ });
+ link.addEventListener('keydown', function(event) {
+ if (event.keyCode == 46 /* DELETE */ ||
huangs 2014/09/11 20:31:41 Need to handle ENTER, perhaps.
Mathieu 2014/09/11 20:54:10 Done.
+ event.keyCode == 8 /* BACKSPACE */) {
+ event.preventDefault();
+ window.parent.postMessage('tileBlacklisted,' + params.pos, DOMAIN_ORIGIN);
+ }
+ });
// Webkit's security policy prevents some Most Visited thumbnails from
// working (those with schemes different from http and https). Therefore,

Powered by Google App Engine
This is Rietveld 408576698