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

Side by Side Diff: chrome/browser/resources/ntp4/dot_list.js

Issue 2059913002: Remove keyIdentifier usage in chrome/browser/resources/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chromeos build Created 4 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 | « chrome/browser/resources/ntp4/apps_page.js ('k') | chrome/browser/resources/ntp4/nav_dot.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * @fileoverview DotList implementation 6 * @fileoverview DotList implementation
7 */ 7 */
8 8
9 cr.define('ntp', function() { 9 cr.define('ntp', function() {
10 'use strict'; 10 'use strict';
(...skipping 30 matching lines...) Expand all
41 /** 41 /**
42 * Handler for key events on the dot list. These keys will change the focus 42 * Handler for key events on the dot list. These keys will change the focus
43 * element. 43 * element.
44 * @param {Event} e The KeyboardEvent. 44 * @param {Event} e The KeyboardEvent.
45 */ 45 */
46 onKeyDown_: function(e) { 46 onKeyDown_: function(e) {
47 if (e.metaKey || e.shiftKey || e.altKey || e.ctrlKey) 47 if (e.metaKey || e.shiftKey || e.altKey || e.ctrlKey)
48 return; 48 return;
49 49
50 var direction = 0; 50 var direction = 0;
51 if (e.keyIdentifier == 'Left') 51 if (e.key == 'ArrowLeft')
52 direction = -1; 52 direction = -1;
53 else if (e.keyIdentifier == 'Right') 53 else if (e.key == 'ArrowRight')
54 direction = 1; 54 direction = 1;
55 else 55 else
56 return; 56 return;
57 57
58 var focusDot = this.querySelector('.dot:focus'); 58 var focusDot = this.querySelector('.dot:focus');
59 if (!focusDot) 59 if (!focusDot)
60 return; 60 return;
61 var focusIndex = Array.prototype.indexOf.call(navDots, focusDot); 61 var focusIndex = Array.prototype.indexOf.call(navDots, focusDot);
62 var newFocusIndex = focusIndex + direction; 62 var newFocusIndex = focusIndex + direction;
63 if (focusIndex == newFocusIndex) 63 if (focusIndex == newFocusIndex)
64 return; 64 return;
65 65
66 newFocusIndex = (newFocusIndex + navDots.length) % navDots.length; 66 newFocusIndex = (newFocusIndex + navDots.length) % navDots.length;
67 navDots[newFocusIndex].tabIndex = 3; 67 navDots[newFocusIndex].tabIndex = 3;
68 navDots[newFocusIndex].focus(); 68 navDots[newFocusIndex].focus();
69 focusDot.tabIndex = -1; 69 focusDot.tabIndex = -1;
70 70
71 e.stopPropagation(); 71 e.stopPropagation();
72 e.preventDefault(); 72 e.preventDefault();
73 } 73 }
74 }; 74 };
75 75
76 return { 76 return {
77 DotList: DotList 77 DotList: DotList
78 }; 78 };
79 }); 79 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/apps_page.js ('k') | chrome/browser/resources/ntp4/nav_dot.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698