@vaadin/menu-bar 24.7.0-alpha6 → 24.7.0-alpha8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/menu-bar",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-alpha8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,21 +37,22 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/a11y-base": "24.7.0-
|
|
41
|
-
"@vaadin/button": "24.7.0-
|
|
42
|
-
"@vaadin/component-base": "24.7.0-
|
|
43
|
-
"@vaadin/context-menu": "24.7.0-
|
|
44
|
-
"@vaadin/item": "24.7.0-
|
|
45
|
-
"@vaadin/list-box": "24.7.0-
|
|
46
|
-
"@vaadin/overlay": "24.7.0-
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
48
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.7.0-alpha8",
|
|
41
|
+
"@vaadin/button": "24.7.0-alpha8",
|
|
42
|
+
"@vaadin/component-base": "24.7.0-alpha8",
|
|
43
|
+
"@vaadin/context-menu": "24.7.0-alpha8",
|
|
44
|
+
"@vaadin/item": "24.7.0-alpha8",
|
|
45
|
+
"@vaadin/list-box": "24.7.0-alpha8",
|
|
46
|
+
"@vaadin/overlay": "24.7.0-alpha8",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-alpha8",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "24.7.0-alpha8",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-alpha8",
|
|
50
50
|
"lit": "^3.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
54
|
-
"@vaadin/icon": "24.7.0-
|
|
53
|
+
"@vaadin/chai-plugins": "24.7.0-alpha8",
|
|
54
|
+
"@vaadin/icon": "24.7.0-alpha8",
|
|
55
|
+
"@vaadin/test-runner-commands": "24.7.0-alpha8",
|
|
55
56
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
56
57
|
"sinon": "^18.0.0"
|
|
57
58
|
},
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"web-types.json",
|
|
60
61
|
"web-types.lit.json"
|
|
61
62
|
],
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d015035192480fcc8cc9df5d00a950f177b83c32"
|
|
63
64
|
}
|
|
@@ -48,6 +48,20 @@ class MenuBarButton extends Button {
|
|
|
48
48
|
super._onKeyDown(event);
|
|
49
49
|
this.__triggeredWithActiveKeys = null;
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Override method inherited from `ButtonMixin` to allow keyboard navigation with
|
|
54
|
+
* arrow keys in the menu bar when the button is focusable in the disabled state.
|
|
55
|
+
*
|
|
56
|
+
* @override
|
|
57
|
+
*/
|
|
58
|
+
__shouldSuppressInteractionEvent(event) {
|
|
59
|
+
if (event.type === 'keydown' && ['ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return super.__shouldSuppressInteractionEvent(event);
|
|
64
|
+
}
|
|
51
65
|
}
|
|
52
66
|
|
|
53
67
|
defineCustomElement(MenuBarButton);
|
|
@@ -45,6 +45,20 @@ class MenuBarButton extends Button {
|
|
|
45
45
|
super._onKeyDown(event);
|
|
46
46
|
this.__triggeredWithActiveKeys = null;
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Override method inherited from `ButtonMixin` to allow keyboard navigation with
|
|
51
|
+
* arrow keys in the menu bar when the button is focusable in the disabled state.
|
|
52
|
+
*
|
|
53
|
+
* @override
|
|
54
|
+
*/
|
|
55
|
+
__shouldSuppressInteractionEvent(event) {
|
|
56
|
+
if (event.type === 'keydown' && ['ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return super.__shouldSuppressInteractionEvent(event);
|
|
61
|
+
}
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
defineCustomElement(MenuBarButton);
|
|
@@ -99,6 +99,24 @@ export declare class MenuBarMixinClass {
|
|
|
99
99
|
* {text: 'Help'}
|
|
100
100
|
* ];
|
|
101
101
|
* ```
|
|
102
|
+
*
|
|
103
|
+
* #### Disabled buttons
|
|
104
|
+
*
|
|
105
|
+
* When disabled, menu bar buttons (root-level items) are rendered
|
|
106
|
+
* as "dimmed" and prevent all user interactions (mouse and keyboard).
|
|
107
|
+
*
|
|
108
|
+
* Since disabled buttons are not focusable and cannot react to hover
|
|
109
|
+
* events by default, it can cause accessibility issues by making them
|
|
110
|
+
* entirely invisible to assistive technologies, and prevents the use
|
|
111
|
+
* of Tooltips to explain why the action is not available. This can be
|
|
112
|
+
* addressed by enabling the feature flag `accessibleDisabledButtons`,
|
|
113
|
+
* which makes disabled buttons focusable and hoverable, while still
|
|
114
|
+
* preventing them from being triggered:
|
|
115
|
+
*
|
|
116
|
+
* ```
|
|
117
|
+
* // Set before any menu bar is attached to the DOM.
|
|
118
|
+
* window.Vaadin.featureFlags.accessibleDisabledButtons = true;
|
|
119
|
+
* ```
|
|
102
120
|
*/
|
|
103
121
|
items: MenuBarItem[];
|
|
104
122
|
|
|
@@ -78,6 +78,29 @@ export const MenuBarMixin = (superClass) =>
|
|
|
78
78
|
* ];
|
|
79
79
|
* ```
|
|
80
80
|
*
|
|
81
|
+
* #### Disabled buttons
|
|
82
|
+
*
|
|
83
|
+
* When disabled, menu bar buttons (root-level items) are rendered
|
|
84
|
+
* as "dimmed" and prevent all user interactions (mouse and keyboard).
|
|
85
|
+
*
|
|
86
|
+
* Since disabled buttons are not focusable and cannot react to hover
|
|
87
|
+
* events by default, it can cause accessibility issues by making them
|
|
88
|
+
* entirely invisible to assistive technologies, and prevents the use
|
|
89
|
+
* of Tooltips to explain why the action is not available. This can be
|
|
90
|
+
* addressed by enabling the feature flag `accessibleDisabledButtons`,
|
|
91
|
+
* which makes disabled buttons focusable and hoverable, while still
|
|
92
|
+
* preventing them from being triggered:
|
|
93
|
+
*
|
|
94
|
+
* ```
|
|
95
|
+
* // Set before any menu bar is attached to the DOM.
|
|
96
|
+
* window.Vaadin.featureFlags.accessibleDisabledButtons = true;
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* ```
|
|
100
|
+
* // Set before any menu bar is attached to the DOM.
|
|
101
|
+
* window.Vaadin.featureFlags.accessibleDisabledButtons = true;
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
81
104
|
* @type {!Array<!MenuBarItem>}
|
|
82
105
|
*/
|
|
83
106
|
items: {
|
|
@@ -688,7 +711,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
688
711
|
|
|
689
712
|
/** @protected */
|
|
690
713
|
_setTabindex(button, focused) {
|
|
691
|
-
if (this.tabNavigation &&
|
|
714
|
+
if (this.tabNavigation && this._isItemFocusable(button)) {
|
|
692
715
|
button.setAttribute('tabindex', '0');
|
|
693
716
|
} else {
|
|
694
717
|
button.setAttribute('tabindex', focused ? '0' : '-1');
|
|
@@ -907,6 +930,10 @@ export const MenuBarMixin = (superClass) =>
|
|
|
907
930
|
|
|
908
931
|
/** @private */
|
|
909
932
|
__openSubMenu(button, keydown, options = {}) {
|
|
933
|
+
if (button.disabled) {
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
|
|
910
937
|
const subMenu = this._subMenu;
|
|
911
938
|
const item = button.item;
|
|
912
939
|
|
|
@@ -1030,4 +1057,20 @@ export const MenuBarMixin = (superClass) =>
|
|
|
1030
1057
|
close() {
|
|
1031
1058
|
this._close();
|
|
1032
1059
|
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Override method inherited from `KeyboardDirectionMixin` to allow
|
|
1063
|
+
* focusing disabled buttons that are configured so.
|
|
1064
|
+
*
|
|
1065
|
+
* @param {Element} button
|
|
1066
|
+
* @protected
|
|
1067
|
+
* @override
|
|
1068
|
+
*/
|
|
1069
|
+
_isItemFocusable(button) {
|
|
1070
|
+
if (button.disabled && button.__shouldAllowFocusWhenDisabled) {
|
|
1071
|
+
return button.__shouldAllowFocusWhenDisabled();
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
return super._isItemFocusable(button);
|
|
1075
|
+
}
|
|
1033
1076
|
};
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha8",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-menu-bar",
|
|
11
|
-
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
11
|
+
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
"name": "items",
|
|
95
|
-
"description": "Defines a hierarchical structure, where root level items represent menu bar buttons,\nand `children` property configures a submenu with items to be opened below\nthe button on click, Enter, Space, Up and Down arrow keys.\n\n#### Example\n\n```js\nmenubar.items = [\n {\n text: 'File',\n className: 'file',\n children: [\n {text: 'Open', className: 'file open'}\n {text: 'Auto Save', checked: true},\n ]\n },\n {component: 'hr'},\n {\n text: 'Edit',\n children: [\n {text: 'Undo', disabled: true},\n {text: 'Redo'}\n ]\n },\n {text: 'Help'}\n];\n```",
|
|
95
|
+
"description": "Defines a hierarchical structure, where root level items represent menu bar buttons,\nand `children` property configures a submenu with items to be opened below\nthe button on click, Enter, Space, Up and Down arrow keys.\n\n#### Example\n\n```js\nmenubar.items = [\n {\n text: 'File',\n className: 'file',\n children: [\n {text: 'Open', className: 'file open'}\n {text: 'Auto Save', checked: true},\n ]\n },\n {component: 'hr'},\n {\n text: 'Edit',\n children: [\n {text: 'Undo', disabled: true},\n {text: 'Redo'}\n ]\n },\n {text: 'Help'}\n];\n```\n\n#### Disabled buttons\n\nWhen disabled, menu bar buttons (root-level items) are rendered\nas \"dimmed\" and prevent all user interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```\n// Set before any menu bar is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n```\n```\n// Set before any menu bar is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n```",
|
|
96
96
|
"value": {
|
|
97
97
|
"type": [
|
|
98
98
|
"Array.<MenuBarItem>"
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/menu-bar",
|
|
4
|
-
"version": "24.7.0-
|
|
4
|
+
"version": "24.7.0-alpha8",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-menu-bar",
|
|
19
|
-
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-
|
|
19
|
+
"description": "`<vaadin-menu-bar>` is a Web Component providing a set of horizontally stacked buttons offering\nthe user quick access to a consistent set of commands. Each button can toggle a submenu with\nsupport for additional levels of nested menus.\n\nTo create the menu bar, first add the component to the page:\n\n```\n<vaadin-menu-bar></vaadin-menu-bar>\n```\n\nAnd then use [`items`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-menu-bar#property-items) property to initialize the structure:\n\n```\ndocument.querySelector('vaadin-menu-bar').items = [{text: 'File'}, {text: 'Edit'}];\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n------------------|----------------\n`container` | The container wrapping menu bar buttons.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n--------------------|----------------------------------\n`disabled` | Set when the menu bar is disabled\n`has-single-button` | Set when there is only one button visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-menu-bar>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-menu-bar-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-item).\n- `<vaadin-menu-bar-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.7.0-alpha8/#/elements/vaadin-overlay).\n\nThe `<vaadin-menu-bar-item>` sub-menu elements have the following additional state attributes\non top of the built-in `<vaadin-item>` state attributes:\n\nAttribute | Description\n---------- |-------------\n`expanded` | Expanded parent item.\n\nNote: the `theme` attribute value set on `<vaadin-menu-bar>` is\npropagated to the internal components listed above.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"name": ".items",
|
|
52
|
-
"description": "Defines a hierarchical structure, where root level items represent menu bar buttons,\nand `children` property configures a submenu with items to be opened below\nthe button on click, Enter, Space, Up and Down arrow keys.\n\n#### Example\n\n```js\nmenubar.items = [\n {\n text: 'File',\n className: 'file',\n children: [\n {text: 'Open', className: 'file open'}\n {text: 'Auto Save', checked: true},\n ]\n },\n {component: 'hr'},\n {\n text: 'Edit',\n children: [\n {text: 'Undo', disabled: true},\n {text: 'Redo'}\n ]\n },\n {text: 'Help'}\n];\n```",
|
|
52
|
+
"description": "Defines a hierarchical structure, where root level items represent menu bar buttons,\nand `children` property configures a submenu with items to be opened below\nthe button on click, Enter, Space, Up and Down arrow keys.\n\n#### Example\n\n```js\nmenubar.items = [\n {\n text: 'File',\n className: 'file',\n children: [\n {text: 'Open', className: 'file open'}\n {text: 'Auto Save', checked: true},\n ]\n },\n {component: 'hr'},\n {\n text: 'Edit',\n children: [\n {text: 'Undo', disabled: true},\n {text: 'Redo'}\n ]\n },\n {text: 'Help'}\n];\n```\n\n#### Disabled buttons\n\nWhen disabled, menu bar buttons (root-level items) are rendered\nas \"dimmed\" and prevent all user interactions (mouse and keyboard).\n\nSince disabled buttons are not focusable and cannot react to hover\nevents by default, it can cause accessibility issues by making them\nentirely invisible to assistive technologies, and prevents the use\nof Tooltips to explain why the action is not available. This can be\naddressed by enabling the feature flag `accessibleDisabledButtons`,\nwhich makes disabled buttons focusable and hoverable, while still\npreventing them from being triggered:\n\n```\n// Set before any menu bar is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n```\n```\n// Set before any menu bar is attached to the DOM.\nwindow.Vaadin.featureFlags.accessibleDisabledButtons = true;\n```",
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|