diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 00:48:39 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 00:48:39 +0000 |
commit | 381cd5a5e63e3a7e5360e889e42d328a5bf93199 (patch) | |
tree | 726254c2724d193c60a64d162694841632c92d1c /chrome/browser | |
parent | a6ed3e143ed88f495e5c00a79ad9ea68f8253533 (diff) | |
download | chromium_src-381cd5a5e63e3a7e5360e889e42d328a5bf93199.zip chromium_src-381cd5a5e63e3a7e5360e889e42d328a5bf93199.tar.gz chromium_src-381cd5a5e63e3a7e5360e889e42d328a5bf93199.tar.bz2 |
NTP: Fix issue where a thumbnail was stuck in hover mode after a delete.
The reason why the thumbnail was stuck is that it was focused due to
the mousedown (the element was reused). Now we blur the element when we
blacklist the thumbnail.
This also adds support for Del (and Cmd+Backspace for mac) to blacklist the
focused thumbnail.
This also fixes the issue where the user could tab to a filler.
BUG=28185
TEST=Remove a thumbnail and move the mouse out of the mostvisited thumbnails.
None of them should be highlighted.
Review URL: http://codereview.chromium.org/414011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/resources/new_new_tab.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index 2e539e3..d409fb0 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -230,8 +230,12 @@ function renderMostVisited(data) { // No need to continue if this is a filler. if (newClassName == 'thumbnail-container filler') { + // Make sure the user cannot tab to the filler. + t.tabIndex = -1; continue; } + // Allow focus. + t.tabIndex = 1; t.href = d.url; t.querySelector('.pin').title = localStrings.getString(d.pinned ? @@ -470,6 +474,11 @@ var mostVisited = { var removeText = localStrings.getString('thumbnailremovednotification'); var notifySpan = document.querySelector('#notification > span'); notifySpan.textContent = removeText; + + // Focus the undo link. + var undoLink = document.querySelector( + '#notification > .link > [tabindex]'); + undoLink.focus(); }); }, @@ -1037,6 +1046,15 @@ $('most-visited').addEventListener('click', function(e) { } }); +// Allow blacklisting most visited site using the keyboard. +$('most-visited').addEventListener('keydown', function(e) { + var isMac = /$Mac/.test(navigator.platform); + if (!isMac && e.keyCode == 46 || // Del + isMac && e.metaKey && e.keyCode == 8) { // Cmd + Backspace + mostVisited.blacklist(e.target); + } +}); + function handleIfEnterKey(f) { return function(e) { if (e.keyIdentifier == 'Enter') { |