OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Polymer({ | 5 Polymer({ |
6 is: 'bookmarks-list', | 6 is: 'bookmarks-list', |
7 | 7 |
8 behaviors: [ | 8 behaviors: [ |
9 bookmarks.StoreClient, | 9 bookmarks.StoreClient, |
10 ], | 10 ], |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 onItemKeydown_: function(e) { | 152 onItemKeydown_: function(e) { |
153 var handled = true; | 153 var handled = true; |
154 var list = this.$.bookmarksCard; | 154 var list = this.$.bookmarksCard; |
155 var focusMoved = false; | 155 var focusMoved = false; |
156 var focusedIndex = | 156 var focusedIndex = |
157 this.getIndexForItemElement_(/** @type {HTMLElement} */ (e.target)); | 157 this.getIndexForItemElement_(/** @type {HTMLElement} */ (e.target)); |
158 var oldFocusedIndex = focusedIndex; | 158 var oldFocusedIndex = focusedIndex; |
159 if (e.key == 'ArrowUp') { | 159 if (e.key == 'ArrowUp') { |
160 focusedIndex--; | 160 focusedIndex--; |
161 focusMoved = true; | 161 focusMoved = true; |
162 } else if (e.key == 'ArrowDown') { | 162 } else if (e.key == 'ArrowDown' && !(cr.isMac && e.metaKey)) { |
163 focusedIndex++; | 163 focusedIndex++; |
164 focusMoved = true; | 164 focusMoved = true; |
165 e.preventDefault(); | 165 e.preventDefault(); |
166 } else if (e.key == 'Home') { | 166 } else if (e.key == 'Home') { |
167 focusedIndex = 0; | 167 focusedIndex = 0; |
168 focusMoved = true; | 168 focusMoved = true; |
169 } else if (e.key == 'End') { | 169 } else if (e.key == 'End') { |
170 focusedIndex = list.items.length - 1; | 170 focusedIndex = list.items.length - 1; |
171 focusMoved = true; | 171 focusMoved = true; |
172 } else if (e.key == ' ' && e.ctrlKey) { | 172 } else if (e.key == ' ' && e.ctrlKey) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 if (!handled) { | 214 if (!handled) { |
215 handled = bookmarks.CommandManager.getInstance().handleKeyEvent( | 215 handled = bookmarks.CommandManager.getInstance().handleKeyEvent( |
216 e, this.getState().selection.items); | 216 e, this.getState().selection.items); |
217 } | 217 } |
218 | 218 |
219 if (handled) | 219 if (handled) |
220 e.stopPropagation(); | 220 e.stopPropagation(); |
221 }, | 221 }, |
222 }); | 222 }); |
OLD | NEW |