Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 The ChromeVox panel and menus. | 6 * @fileoverview The ChromeVox panel and menus. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('Panel'); | 9 goog.provide('Panel'); |
| 10 | 10 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 | 487 |
| 488 /** | 488 /** |
| 489 * Called when a key is pressed. Handle arrow keys to navigate the menus, | 489 * Called when a key is pressed. Handle arrow keys to navigate the menus, |
| 490 * Esc to close, and Enter/Space to activate an item. | 490 * Esc to close, and Enter/Space to activate an item. |
| 491 * @param {Event} event The key event. | 491 * @param {Event} event The key event. |
| 492 */ | 492 */ |
| 493 Panel.onKeyDown = function(event) { | 493 Panel.onKeyDown = function(event) { |
| 494 if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) | 494 if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) |
| 495 return; | 495 return; |
| 496 | 496 |
| 497 switch (event.keyIdentifier) { | 497 switch (event.key) { |
| 498 case 'Left': | 498 case 'ArrowLeft': |
| 499 Panel.advanceActiveMenuBy(-1); | 499 Panel.advanceActiveMenuBy(-1); |
| 500 break; | 500 break; |
| 501 case 'Right': | 501 case 'ArrowRight': |
| 502 Panel.advanceActiveMenuBy(1); | 502 Panel.advanceActiveMenuBy(1); |
| 503 break; | 503 break; |
| 504 case 'Up': | 504 case 'ArrowUp': |
| 505 Panel.advanceItemBy(-1); | 505 Panel.advanceItemBy(-1); |
| 506 break; | 506 break; |
| 507 case 'Down': | 507 case 'ArrowDown': |
| 508 Panel.advanceItemBy(1); | 508 Panel.advanceItemBy(1); |
| 509 break; | 509 break; |
| 510 case 'U+001B': // Escape | 510 case 'Escape': |
| 511 Panel.closeMenusAndRestoreFocus(); | 511 Panel.closeMenusAndRestoreFocus(); |
| 512 break; | 512 break; |
| 513 case 'Enter': // Enter | 513 case 'Enter': // Enter |
|
Dan Beam
2016/06/14 00:20:27
probably don't need this comment
| |
| 514 case 'U+0020': // Space | 514 case ' ': // Space |
| 515 Panel.pendingCallback_ = Panel.getCallbackForCurrentItem(); | 515 Panel.pendingCallback_ = Panel.getCallbackForCurrentItem(); |
| 516 Panel.closeMenusAndRestoreFocus(); | 516 Panel.closeMenusAndRestoreFocus(); |
| 517 break; | 517 break; |
| 518 default: | 518 default: |
| 519 // Don't mark this event as handled. | 519 // Don't mark this event as handled. |
| 520 return; | 520 return; |
| 521 } | 521 } |
| 522 | 522 |
| 523 event.preventDefault(); | 523 event.preventDefault(); |
| 524 event.stopPropagation(); | 524 event.stopPropagation(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 }, false); | 584 }, false); |
| 585 | 585 |
| 586 window.addEventListener('hashchange', function() { | 586 window.addEventListener('hashchange', function() { |
| 587 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 587 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
| 588 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 588 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
| 589 cvox.ChromeVox.isStickyPrefOn = false; | 589 cvox.ChromeVox.isStickyPrefOn = false; |
| 590 } else { | 590 } else { |
| 591 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 591 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
| 592 } | 592 } |
| 593 }, false); | 593 }, false); |
| OLD | NEW |