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

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: nits 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
« no previous file with comments | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c957279ac85aa2785912ca229906324f3d480dcb 100644
--- a/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -123,20 +123,26 @@ 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);
+ });
// Webkit's security policy prevents some Most Visited thumbnails from
// working (those with schemes different from http and https). Therefore,
// navigateContentWindow is being used in order to get all schemes working.
- link.addEventListener('click', function handleNavigation(e) {
+ var navigateFunction = function handleNavigation(e) {
var isServerSuggestion = 'url' in params;
// Ping are only populated for server-side suggestions, never for MV.
@@ -155,6 +161,18 @@ function createMostVisitedLink(params, href, title, text, direction, provider) {
ntpApiHandle.navigateContentWindow(href, getDispositionFromEvent(e));
}
// Else follow <a> normally, so transition type would be LINK.
+ };
+
+ link.addEventListener('click', navigateFunction);
+ link.addEventListener('keydown', function(event) {
+ if (event.keyCode == 46 /* DELETE */ ||
+ event.keyCode == 8 /* BACKSPACE */) {
+ event.preventDefault();
+ window.parent.postMessage('tileBlacklisted,' + params.pos, DOMAIN_ORIGIN);
+ } else if (event.keyCode == 13 /* ENTER */ ||
+ event.keyCode == 32 /* SPACE */) {
+ navigateFunction(event);
+ }
});
return link;
« no previous file with comments | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698