Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / iron-menu-behavior / iron-menubar-behavior-extracted.js
blob744a158d66f18318edb6202d2d11f5754603bf5b
3   /**
4    * `Polymer.IronMenubarBehavior` implements accessible menubar behavior.
5    *
6    * @polymerBehavior Polymer.IronMenubarBehavior
7    */
8   Polymer.IronMenubarBehaviorImpl = {
10     hostAttributes: {
11       'role': 'menubar'
12     },
14     keyBindings: {
15       'left': '_onLeftKey',
16       'right': '_onRightKey'
17     },
19     _onUpKey: function(event) {
20       this._activateFocused(event.detail.keyboardEvent);
21     },
23     _onDownKey: function(event) {
24       this._activateFocused(event.detail.keyboardEvent);
25     },
27     _onLeftKey: function() {
28       this._focusPrevious();
29     },
31     _onRightKey: function() {
32       this._focusNext();
33     },
35     _onKeydown: function(event) {
36       if (this.keyboardEventMatchesKeys(event, 'up down left right esc enter')) {
37         return;
38       }
40       // all other keys focus the menu item starting with that character
41       this._focusWithKeyboardEvent(event);
42     }
44   };
46   /** @polymerBehavior Polymer.IronMenubarBehavior */
47   Polymer.IronMenubarBehavior = [
48     Polymer.IronMenuBehavior,
49     Polymer.IronMenubarBehaviorImpl
50   ];