OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 hostAttributes: { | 23 hostAttributes: { |
24 'role': 'menubar' | 24 'role': 'menubar' |
25 }, | 25 }, |
26 | 26 |
27 keyBindings: { | 27 keyBindings: { |
28 'left': '_onLeftKey', | 28 'left': '_onLeftKey', |
29 'right': '_onRightKey' | 29 'right': '_onRightKey' |
30 }, | 30 }, |
31 | 31 |
32 _onUpKey: function(event) { | 32 _onUpKey: function(event) { |
33 this._activateFocused(event.detail.keyboardEvent); | 33 this.focusedItem.click(); |
| 34 event.detail.keyboardEvent.preventDefault(); |
34 }, | 35 }, |
35 | 36 |
36 _onDownKey: function(event) { | 37 _onDownKey: function(event) { |
37 this._activateFocused(event.detail.keyboardEvent); | 38 this.focusedItem.click(); |
| 39 event.detail.keyboardEvent.preventDefault(); |
38 }, | 40 }, |
39 | 41 |
40 _onLeftKey: function() { | 42 _onLeftKey: function() { |
41 this._focusPrevious(); | 43 this._focusPrevious(); |
42 }, | 44 }, |
43 | 45 |
44 _onRightKey: function() { | 46 _onRightKey: function() { |
45 this._focusNext(); | 47 this._focusNext(); |
46 }, | 48 }, |
47 | 49 |
48 _onKeydown: function(event) { | 50 _onKeydown: function(event) { |
49 if (this.keyboardEventMatchesKeys(event, 'up down left right esc enter'))
{ | 51 if (this.keyboardEventMatchesKeys(event, 'up down left right esc')) { |
50 return; | 52 return; |
51 } | 53 } |
52 | 54 |
53 // all other keys focus the menu item starting with that character | 55 // all other keys focus the menu item starting with that character |
54 this._focusWithKeyboardEvent(event); | 56 this._focusWithKeyboardEvent(event); |
55 } | 57 } |
56 | 58 |
57 }; | 59 }; |
58 | 60 |
59 /** @polymerBehavior Polymer.IronMenubarBehavior */ | 61 /** @polymerBehavior Polymer.IronMenubarBehavior */ |
60 Polymer.IronMenubarBehavior = [ | 62 Polymer.IronMenubarBehavior = [ |
61 Polymer.IronMenuBehavior, | 63 Polymer.IronMenuBehavior, |
62 Polymer.IronMenubarBehaviorImpl | 64 Polymer.IronMenubarBehaviorImpl |
63 ]; | 65 ]; |
64 | 66 |
65 </script> | 67 </script> |
OLD | NEW |