| OLD | NEW |
| 1 /** | 1 /** |
| 2 * `Polymer.IronMenubarBehavior` implements accessible menubar behavior. | 2 * `Polymer.IronMenubarBehavior` implements accessible menubar behavior. |
| 3 * | 3 * |
| 4 * @polymerBehavior Polymer.IronMenubarBehavior | 4 * @polymerBehavior Polymer.IronMenubarBehavior |
| 5 */ | 5 */ |
| 6 Polymer.IronMenubarBehaviorImpl = { | 6 Polymer.IronMenubarBehaviorImpl = { |
| 7 | 7 |
| 8 hostAttributes: { | 8 hostAttributes: { |
| 9 'role': 'menubar' | 9 'role': 'menubar' |
| 10 }, | 10 }, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 _onDownKey: function(event) { | 22 _onDownKey: function(event) { |
| 23 this.focusedItem.click(); | 23 this.focusedItem.click(); |
| 24 event.detail.keyboardEvent.preventDefault(); | 24 event.detail.keyboardEvent.preventDefault(); |
| 25 }, | 25 }, |
| 26 | 26 |
| 27 get _isRTL() { | 27 get _isRTL() { |
| 28 return window.getComputedStyle(this)['direction'] === 'rtl'; | 28 return window.getComputedStyle(this)['direction'] === 'rtl'; |
| 29 }, | 29 }, |
| 30 | 30 |
| 31 _onLeftKey: function() { | 31 _onLeftKey: function(event) { |
| 32 if (this._isRTL) { | 32 if (this._isRTL) { |
| 33 this._focusNext(); | 33 this._focusNext(); |
| 34 } else { | 34 } else { |
| 35 this._focusPrevious(); | 35 this._focusPrevious(); |
| 36 } | 36 } |
| 37 event.detail.keyboardEvent.preventDefault(); |
| 37 }, | 38 }, |
| 38 | 39 |
| 39 _onRightKey: function() { | 40 _onRightKey: function(event) { |
| 40 if (this._isRTL) { | 41 if (this._isRTL) { |
| 41 this._focusPrevious(); | 42 this._focusPrevious(); |
| 42 } else { | 43 } else { |
| 43 this._focusNext(); | 44 this._focusNext(); |
| 44 } | 45 } |
| 46 event.detail.keyboardEvent.preventDefault(); |
| 45 }, | 47 }, |
| 46 | 48 |
| 47 _onKeydown: function(event) { | 49 _onKeydown: function(event) { |
| 48 if (this.keyboardEventMatchesKeys(event, 'up down left right esc')) { | 50 if (this.keyboardEventMatchesKeys(event, 'up down left right esc')) { |
| 49 return; | 51 return; |
| 50 } | 52 } |
| 51 | 53 |
| 52 // all other keys focus the menu item starting with that character | 54 // all other keys focus the menu item starting with that character |
| 53 this._focusWithKeyboardEvent(event); | 55 this._focusWithKeyboardEvent(event); |
| 54 } | 56 } |
| 55 | 57 |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 /** @polymerBehavior Polymer.IronMenubarBehavior */ | 60 /** @polymerBehavior Polymer.IronMenubarBehavior */ |
| 59 Polymer.IronMenubarBehavior = [ | 61 Polymer.IronMenubarBehavior = [ |
| 60 Polymer.IronMenuBehavior, | 62 Polymer.IronMenuBehavior, |
| 61 Polymer.IronMenubarBehaviorImpl | 63 Polymer.IronMenubarBehaviorImpl |
| 62 ]; | 64 ]; |
| OLD | NEW |