OLD | NEW |
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 // <include src="../../assert.js"> | 5 // <include src="../../assert.js"> |
6 | 6 |
7 cr.exportPath('cr.ui'); | 7 cr.exportPath('cr.ui'); |
8 | 8 |
9 /** | 9 /** |
10 * Enum for type of hide. Delayed is used when called by clicking on a | 10 * Enum for type of hide. Delayed is used when called by clicking on a |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 */ | 259 */ |
260 positionMenu_: function() { | 260 positionMenu_: function() { |
261 positionPopupAroundElement(this, this.menu, this.anchorType, | 261 positionPopupAroundElement(this, this.menu, this.anchorType, |
262 this.invertLeftRight); | 262 this.invertLeftRight); |
263 }, | 263 }, |
264 | 264 |
265 /** | 265 /** |
266 * Handles the keydown event for the menu button. | 266 * Handles the keydown event for the menu button. |
267 */ | 267 */ |
268 handleKeyDown: function(e) { | 268 handleKeyDown: function(e) { |
269 switch (e.keyIdentifier) { | 269 switch (e.key) { |
270 case 'Down': | 270 case 'ArrowDown': |
271 case 'Up': | 271 case 'ArrowUp': |
272 if (!this.respondToArrowKeys) | 272 if (!this.respondToArrowKeys) |
273 break; | 273 break; |
274 case 'Enter': | 274 case 'Enter': |
275 case 'U+0020': // Space | 275 case ' ': |
276 if (!this.isMenuShown()) | 276 if (!this.isMenuShown()) |
277 this.showMenu(true); | 277 this.showMenu(true); |
278 e.preventDefault(); | 278 e.preventDefault(); |
279 break; | 279 break; |
280 case 'Esc': | 280 case 'Escape': |
281 case 'U+001B': // Maybe this is remote desktop playing a prank? | 281 case 'Tab': |
282 case 'U+0009': // Tab | |
283 this.hideMenu(); | 282 this.hideMenu(); |
284 break; | 283 break; |
285 } | 284 } |
286 } | 285 } |
287 }; | 286 }; |
288 | 287 |
289 // Export | 288 // Export |
290 return { | 289 return { |
291 MenuButton: MenuButton, | 290 MenuButton: MenuButton, |
292 }; | 291 }; |
293 }); | 292 }); |
OLD | NEW |