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

Side by Side Diff: ui/webui/resources/js/cr/ui/focus_row.js

Issue 2104103002: Convert Event#keyIdentifier (deprecated) to Event#key (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch file manager test Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 cr.define('cr.ui', function() { 5 cr.define('cr.ui', function() {
6 /** 6 /**
7 * A class to manage focus between given horizontally arranged elements. 7 * A class to manage focus between given horizontally arranged elements.
8 * 8 *
9 * Pressing left cycles backward and pressing right cycles forward in item 9 * Pressing left cycles backward and pressing right cycles forward in item
10 * order. Pressing Home goes to the beginning of the list and End goes to the 10 * order. Pressing Home goes to the beginning of the list and End goes to the
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 assert(elementIndex >= 0); 264 assert(elementIndex >= 0);
265 265
266 if (this.delegate && this.delegate.onKeydown(this, e)) 266 if (this.delegate && this.delegate.onKeydown(this, e))
267 return; 267 return;
268 268
269 if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) 269 if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)
270 return; 270 return;
271 271
272 var index = -1; 272 var index = -1;
273 273
274 if (e.keyIdentifier == 'Left') 274 if (e.key == 'ArrowLeft')
275 index = elementIndex + (isRTL() ? 1 : -1); 275 index = elementIndex + (isRTL() ? 1 : -1);
276 else if (e.keyIdentifier == 'Right') 276 else if (e.key == 'ArrowRight')
277 index = elementIndex + (isRTL() ? -1 : 1); 277 index = elementIndex + (isRTL() ? -1 : 1);
278 else if (e.keyIdentifier == 'Home') 278 else if (e.key == 'Home')
279 index = 0; 279 index = 0;
280 else if (e.keyIdentifier == 'End') 280 else if (e.key == 'End')
281 index = elements.length - 1; 281 index = elements.length - 1;
282 282
283 var elementToFocus = elements[index]; 283 var elementToFocus = elements[index];
284 if (elementToFocus) { 284 if (elementToFocus) {
285 this.getEquivalentElement(elementToFocus).focus(); 285 this.getEquivalentElement(elementToFocus).focus();
286 e.preventDefault(); 286 e.preventDefault();
287 } 287 }
288 }, 288 },
289 }; 289 };
290 290
291 return { 291 return {
292 FocusRow: FocusRow, 292 FocusRow: FocusRow,
293 }; 293 };
294 }); 294 });
OLDNEW
« no previous file with comments | « ui/webui/resources/js/cr/ui/focus_grid.js ('k') | ui/webui/resources/js/cr/ui/list_selection_controller.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698