OLD | NEW |
| (Empty) |
1 | |
2 | |
3 /** | |
4 * `Polymer.IronMenubarBehavior` implements accessible menubar behavior. | |
5 * | |
6 * @polymerBehavior Polymer.IronMenubarBehavior | |
7 */ | |
8 Polymer.IronMenubarBehaviorImpl = { | |
9 | |
10 hostAttributes: { | |
11 'role': 'menubar' | |
12 }, | |
13 | |
14 keyBindings: { | |
15 'left': '_onLeftKey', | |
16 'right': '_onRightKey' | |
17 }, | |
18 | |
19 _onUpKey: function(event) { | |
20 this._activateFocused(event.detail.keyboardEvent); | |
21 }, | |
22 | |
23 _onDownKey: function(event) { | |
24 this._activateFocused(event.detail.keyboardEvent); | |
25 }, | |
26 | |
27 _onLeftKey: function() { | |
28 this._focusPrevious(); | |
29 }, | |
30 | |
31 _onRightKey: function() { | |
32 this._focusNext(); | |
33 }, | |
34 | |
35 _onKeydown: function(event) { | |
36 if (this.keyboardEventMatchesKeys(event, 'up down left right esc enter'))
{ | |
37 return; | |
38 } | |
39 | |
40 // all other keys focus the menu item starting with that character | |
41 this._focusWithKeyboardEvent(event); | |
42 } | |
43 | |
44 }; | |
45 | |
46 /** @polymerBehavior Polymer.IronMenubarBehavior */ | |
47 Polymer.IronMenubarBehavior = [ | |
48 Polymer.IronMenuBehavior, | |
49 Polymer.IronMenubarBehaviorImpl | |
50 ]; | |
51 | |
OLD | NEW |