Skip to content

Commit

Permalink
Don't close cookies view on search enter.
Browse files Browse the repository at this point in the history
Hitting enter in this field should be a no-op instead of closing
the overlay, as hitting enter is a natural thing to do when done
typing in a search.

BUG=266710

Review URL: https://chromiumcodereview.appspot.com/22298002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215831 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rfevang@chromium.org committed Aug 6, 2013
1 parent cf64283 commit 5d0cd83
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chrome/browser/resources/options/cookies_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ cr.define('options', function() {
initializePage: function() {
OptionsPage.prototype.initializePage.call(this);

this.pageDiv.querySelector('.cookies-search-box').addEventListener(
var searchBox = this.pageDiv.querySelector('.cookies-search-box');
searchBox.addEventListener(
'search', this.handleSearchQueryChange_.bind(this));
searchBox.onkeydown = function(e) {
// Prevent the overlay from handling this event.
if (e.keyIdentifier == 'Enter')
e.stopPropagation();
};

this.pageDiv.querySelector('.remove-all-cookies-button').onclick =
function(e) {
Expand Down
12 changes: 12 additions & 0 deletions chrome/browser/ui/webui/options/cookies_view_browsertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ CookiesViewWebUITest.prototype = {
TEST_F('CookiesViewWebUITest', 'DISABLED_testOpenCookiesView', function() {
assertEquals(this.browsePreload, document.location.href);
});

TEST_F('CookiesViewWebUITest', 'testNoCloseOnSearchEnter', function() {
var cookiesView = CookiesView.getInstance();
assertTrue(cookiesView.visible);
var searchBox = cookiesView.pageDiv.querySelector('.cookies-search-box');
searchBox.dispatchEvent(new KeyboardEvent('keydown', {
'bubbles': true,
'cancelable': true,
'keyIdentifier': 'Enter'
}));
assertTrue(cookiesView.visible);
});

0 comments on commit 5d0cd83

Please sign in to comment.