Chromium Code Reviews| Index: chrome/browser/resources/local_ntp/local_ntp.js |
| diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js |
| index 43b0f717ac4c5173b699fbb2499c33b1a5fba58a..cfe4770b703c304ea4c33f588a6109464bb7c59d 100644 |
| --- a/chrome/browser/resources/local_ntp/local_ntp.js |
| +++ b/chrome/browser/resources/local_ntp/local_ntp.js |
| @@ -648,6 +648,13 @@ var KEY_UP_ARROW = 38; |
| var KEY_DOWN_ARROW = 40; |
| /** |
| + * "Esc" keycode. |
| + * @type {number} |
| + * @const |
| + */ |
| +var KEY_ESC = 27; |
| + |
| +/** |
| * Pixels of padding inside a suggestion div for displaying its icon. |
| * @type {number} |
| * @const |
| @@ -1311,15 +1318,19 @@ function setSuggestionStyles() { |
| * @param {Object} e The key being pressed. |
| */ |
| function handleKeyPress(e) { |
| - if (!activeBox) |
| - return; |
| - |
| switch (e.keyCode) { |
| case KEY_UP_ARROW: |
| - activeBox.selectPrevious(); |
| + if (activeBox) |
| + activeBox.selectPrevious(); |
| break; |
| case KEY_DOWN_ARROW: |
| - activeBox.selectNext(); |
| + if (activeBox) |
| + activeBox.selectNext(); |
| + break; |
| + case KEY_ESC: |
| + hideActiveSuggestions(); |
|
samarth
2013/05/04 01:04:17
There are two cases here too :)
1) You type someth
kmadhusu
2013/05/04 03:34:38
Done.
|
| + document.body.classList.remove(CLASSES.HIDE_NTP); |
| + onThemeChange(); |
|
samarth
2013/05/04 01:04:17
Not sure if this is the right way to go back to th
kmadhusu
2013/05/04 03:34:38
This call reloads the background theme if one exis
|
| break; |
| } |
| } |