OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 7 /** |
8 * Returns the TabBox for a Tab or a TabPanel. | 8 * Returns the TabBox for a Tab or a TabPanel. |
9 * @param {Tab|TabPanel} el The tab or tabpanel element. | 9 * @param {Tab|TabPanel} el The tab or tabpanel element. |
10 * @return {TabBox} The tab box if found. | 10 * @return {TabBox} The tab box if found. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 }, | 143 }, |
144 | 144 |
145 /** | 145 /** |
146 * Handle keydown to change the selected tab when the user presses the | 146 * Handle keydown to change the selected tab when the user presses the |
147 * arrow keys. | 147 * arrow keys. |
148 * @param {Event} e The keyboard event. | 148 * @param {Event} e The keyboard event. |
149 * @private | 149 * @private |
150 */ | 150 */ |
151 handleKeyDown_: function(e) { | 151 handleKeyDown_: function(e) { |
152 var delta = 0; | 152 var delta = 0; |
153 switch (e.keyIdentifier) { | 153 switch (e.key) { |
154 case 'Left': | 154 case 'ArrowLeft': |
155 case 'Up': | 155 case 'ArrowUp': |
156 delta = -1; | 156 delta = -1; |
157 break; | 157 break; |
158 case 'Right': | 158 case 'ArrowRight': |
159 case 'Down': | 159 case 'ArrowDown': |
160 delta = 1; | 160 delta = 1; |
161 break; | 161 break; |
162 } | 162 } |
163 | 163 |
164 if (!delta) | 164 if (!delta) |
165 return; | 165 return; |
166 | 166 |
167 var cs = this.ownerDocument.defaultView.getComputedStyle(this); | 167 var cs = this.ownerDocument.defaultView.getComputedStyle(this); |
168 if (cs.direction == 'rtl') | 168 if (cs.direction == 'rtl') |
169 delta *= -1; | 169 delta *= -1; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 cr.defineProperty(TabPanel, 'selected', cr.PropertyKind.BOOL_ATTR); | 232 cr.defineProperty(TabPanel, 'selected', cr.PropertyKind.BOOL_ATTR); |
233 | 233 |
234 return { | 234 return { |
235 TabBox: TabBox, | 235 TabBox: TabBox, |
236 Tabs: Tabs, | 236 Tabs: Tabs, |
237 Tab: Tab, | 237 Tab: Tab, |
238 TabPanels: TabPanels, | 238 TabPanels: TabPanels, |
239 TabPanel: TabPanel | 239 TabPanel: TabPanel |
240 }; | 240 }; |
241 }); | 241 }); |
OLD | NEW |