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

Side by Side Diff: ui/webui/resources/js/cr/ui/menu_button.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
« no previous file with comments | « ui/webui/resources/js/cr/ui/menu.js ('k') | ui/webui/resources/js/cr/ui/menu_item.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 // <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
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 });
OLDNEW
« no previous file with comments | « ui/webui/resources/js/cr/ui/menu.js ('k') | ui/webui/resources/js/cr/ui/menu_item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698