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

Side by Side Diff: chrome/browser/resources/md_history/history_item.js

Issue 2907113002: [MD History] Allow Home and End to scroll the history list. (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @param {!Element} root 6 * @param {!Element} root
7 * @param {?Element} boundary 7 * @param {?Element} boundary
8 * @param {cr.ui.FocusRow.Delegate} delegate 8 * @param {cr.ui.FocusRow.Delegate} delegate
9 * @constructor 9 * @constructor
10 * @extends {cr.ui.FocusRow} 10 * @extends {cr.ui.FocusRow}
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 this.historyItemElement.lastFocused = e.path[0]; 59 this.historyItemElement.lastFocused = e.path[0];
60 }, 60 },
61 61
62 /** 62 /**
63 * @override 63 * @override
64 * @param {!cr.ui.FocusRow} row The row that detected a keydown. 64 * @param {!cr.ui.FocusRow} row The row that detected a keydown.
65 * @param {!Event} e 65 * @param {!Event} e
66 * @return {boolean} Whether the event was handled. 66 * @return {boolean} Whether the event was handled.
67 */ 67 */
68 onKeydown: function(row, e) { 68 onKeydown: function(row, e) {
69 // Allow Home and End to move the history list.
70 if (e.key == 'Home' || e.key == 'End')
71 return true;
72
69 // Prevent iron-list from changing the focus on enter. 73 // Prevent iron-list from changing the focus on enter.
70 if (e.key == 'Enter') 74 if (e.key == 'Enter')
71 e.stopPropagation(); 75 e.stopPropagation();
72 76
73 return false; 77 return false;
74 }, 78 },
75 }; 79 };
76 80
77 var HistoryItem = Polymer({ 81 var HistoryItem = Polymer({
78 is: 'history-item', 82 is: 'history-item',
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 */ 335 */
332 HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) { 336 HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) {
333 var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults'; 337 var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults';
334 return loadTimeData.getStringF( 338 return loadTimeData.getStringF(
335 'foundSearchResults', numberOfResults, loadTimeData.getString(resultId), 339 'foundSearchResults', numberOfResults, loadTimeData.getString(resultId),
336 searchTerm); 340 searchTerm);
337 }; 341 };
338 342
339 return {HistoryItem: HistoryItem}; 343 return {HistoryItem: HistoryItem};
340 }); 344 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698