@vaadin/menu-bar 24.8.0-alpha13 → 24.8.0-alpha14
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 +15 -15
- package/src/vaadin-menu-bar-mixin.js +28 -55
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/menu-bar",
|
|
3
|
-
"version": "24.8.0-
|
|
3
|
+
"version": "24.8.0-alpha14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,22 +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.8.0-
|
|
41
|
-
"@vaadin/button": "24.8.0-
|
|
42
|
-
"@vaadin/component-base": "24.8.0-
|
|
43
|
-
"@vaadin/context-menu": "24.8.0-
|
|
44
|
-
"@vaadin/item": "24.8.0-
|
|
45
|
-
"@vaadin/list-box": "24.8.0-
|
|
46
|
-
"@vaadin/overlay": "24.8.0-
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "24.8.0-
|
|
48
|
-
"@vaadin/vaadin-material-styles": "24.8.0-
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.8.0-alpha14",
|
|
41
|
+
"@vaadin/button": "24.8.0-alpha14",
|
|
42
|
+
"@vaadin/component-base": "24.8.0-alpha14",
|
|
43
|
+
"@vaadin/context-menu": "24.8.0-alpha14",
|
|
44
|
+
"@vaadin/item": "24.8.0-alpha14",
|
|
45
|
+
"@vaadin/list-box": "24.8.0-alpha14",
|
|
46
|
+
"@vaadin/overlay": "24.8.0-alpha14",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "24.8.0-alpha14",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "24.8.0-alpha14",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha14",
|
|
50
50
|
"lit": "^3.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@vaadin/chai-plugins": "24.8.0-
|
|
54
|
-
"@vaadin/icon": "24.8.0-
|
|
55
|
-
"@vaadin/test-runner-commands": "24.8.0-
|
|
53
|
+
"@vaadin/chai-plugins": "24.8.0-alpha14",
|
|
54
|
+
"@vaadin/icon": "24.8.0-alpha14",
|
|
55
|
+
"@vaadin/test-runner-commands": "24.8.0-alpha14",
|
|
56
56
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
57
57
|
"sinon": "^18.0.0"
|
|
58
58
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"web-types.json",
|
|
61
61
|
"web-types.lit.json"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c8a33608cf1ab377529afd0650360e349886384c"
|
|
64
64
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
7
7
|
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
8
|
-
import { isElementFocused,
|
|
8
|
+
import { isElementFocused, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
9
9
|
import { KeyboardDirectionMixin } from '@vaadin/a11y-base/src/keyboard-direction-mixin.js';
|
|
10
10
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
11
11
|
import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
@@ -235,6 +235,17 @@ export const MenuBarMixin = (superClass) =>
|
|
|
235
235
|
return false;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Override getter from `KeyboardDirectionMixin`.
|
|
240
|
+
*
|
|
241
|
+
* @return {boolean}
|
|
242
|
+
* @protected
|
|
243
|
+
* @override
|
|
244
|
+
*/
|
|
245
|
+
get _tabNavigation() {
|
|
246
|
+
return this.tabNavigation;
|
|
247
|
+
}
|
|
248
|
+
|
|
238
249
|
/**
|
|
239
250
|
* Override getter from `ResizeMixin` to observe parent.
|
|
240
251
|
*
|
|
@@ -759,12 +770,7 @@ export const MenuBarMixin = (superClass) =>
|
|
|
759
770
|
*/
|
|
760
771
|
_setFocused(focused) {
|
|
761
772
|
if (focused) {
|
|
762
|
-
|
|
763
|
-
if (this.tabNavigation) {
|
|
764
|
-
// Switch submenu on menu button Tab / Shift Tab
|
|
765
|
-
target = this.querySelector('[focused]');
|
|
766
|
-
this.__switchSubMenu(target);
|
|
767
|
-
}
|
|
773
|
+
const target = this.tabNavigation ? this.querySelector('[focused]') : this.querySelector('[tabindex="0"]');
|
|
768
774
|
if (target) {
|
|
769
775
|
this._buttons.forEach((btn) => {
|
|
770
776
|
this._setTabindex(btn, btn === target);
|
|
@@ -883,38 +889,15 @@ export const MenuBarMixin = (superClass) =>
|
|
|
883
889
|
if (e.keyCode === 38 && item === list.items[0]) {
|
|
884
890
|
this._close(true);
|
|
885
891
|
}
|
|
886
|
-
// ArrowLeft, or ArrowRight on non-parent submenu item
|
|
892
|
+
// ArrowLeft, or ArrowRight on non-parent submenu item,
|
|
887
893
|
if (e.keyCode === 37 || (e.keyCode === 39 && !item._item.children)) {
|
|
888
894
|
// Prevent ArrowLeft from being handled in context-menu
|
|
889
895
|
e.stopImmediatePropagation();
|
|
890
896
|
this._onKeyDown(e);
|
|
891
|
-
} else if (e.keyCode === 9 && this.tabNavigation) {
|
|
892
|
-
// Switch opened submenu on submenu item Tab / Shift Tab
|
|
893
|
-
const items = this._getItems() || [];
|
|
894
|
-
const currentIdx = items.indexOf(this.focused);
|
|
895
|
-
const increment = e.shiftKey ? -1 : 1;
|
|
896
|
-
let idx = currentIdx + increment;
|
|
897
|
-
idx = this._getAvailableIndex(items, idx, increment, (item) => !isElementHidden(item));
|
|
898
|
-
|
|
899
|
-
if ((idx > currentIdx && e.shiftKey) || (idx < currentIdx && !e.shiftKey)) {
|
|
900
|
-
// Prevent "roving tabindex" logic and let the normal Tab behavior if
|
|
901
|
-
// - currently in the first button submenu and Shift + Tab is pressed,
|
|
902
|
-
// - currently in the last button submenu and Tab is pressed.
|
|
903
|
-
return;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
this.__switchSubMenu(items[idx]);
|
|
907
897
|
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
898
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
const wasExpanded = this._expandedButton != null && this._expandedButton !== target;
|
|
914
|
-
if (wasExpanded) {
|
|
915
|
-
this._close();
|
|
916
|
-
if (target.item && target.item.children) {
|
|
917
|
-
this.__openSubMenu(target, true, { keepFocus: true });
|
|
899
|
+
if (e.key === 'Tab' && this.tabNavigation) {
|
|
900
|
+
this._onKeyDown(e);
|
|
918
901
|
}
|
|
919
902
|
}
|
|
920
903
|
}
|
|
@@ -959,31 +942,21 @@ export const MenuBarMixin = (superClass) =>
|
|
|
959
942
|
const overlay = subMenu._overlayElement;
|
|
960
943
|
overlay.noVerticalOverlap = true;
|
|
961
944
|
|
|
962
|
-
this.
|
|
963
|
-
|
|
964
|
-
requestAnimationFrame(() => {
|
|
965
|
-
// After changing items, buttons are recreated so the old button is
|
|
966
|
-
// no longer in the DOM. Reset position target to null to prevent
|
|
967
|
-
// overlay from closing due to target width / height equal to 0.
|
|
968
|
-
if (overlay.positionTarget && !overlay.positionTarget.isConnected) {
|
|
969
|
-
overlay.positionTarget = null;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
button.dispatchEvent(
|
|
973
|
-
new CustomEvent('opensubmenu', {
|
|
974
|
-
detail: {
|
|
975
|
-
children: items,
|
|
976
|
-
},
|
|
977
|
-
}),
|
|
978
|
-
);
|
|
979
|
-
this._hideTooltip(true);
|
|
980
|
-
|
|
981
|
-
this._setExpanded(button, true);
|
|
945
|
+
this._hideTooltip(true);
|
|
982
946
|
|
|
983
|
-
|
|
984
|
-
|
|
947
|
+
this._expandedButton = button;
|
|
948
|
+
this._setExpanded(button, true);
|
|
985
949
|
|
|
986
950
|
this.style.pointerEvents = 'auto';
|
|
951
|
+
overlay.positionTarget = button;
|
|
952
|
+
|
|
953
|
+
button.dispatchEvent(
|
|
954
|
+
new CustomEvent('opensubmenu', {
|
|
955
|
+
detail: {
|
|
956
|
+
children: items,
|
|
957
|
+
},
|
|
958
|
+
}),
|
|
959
|
+
);
|
|
987
960
|
|
|
988
961
|
overlay.addEventListener(
|
|
989
962
|
'vaadin-overlay-open',
|
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.8.0-
|
|
4
|
+
"version": "24.8.0-alpha14",
|
|
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.8.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.8.0-alpha14/#/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.8.0-alpha14/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha14/#/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.8.0-alpha14/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha14/#/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",
|
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.8.0-
|
|
4
|
+
"version": "24.8.0-alpha14",
|
|
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.8.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.8.0-alpha14/#/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.8.0-alpha14/#/elements/vaadin-button).\n- `<vaadin-menu-bar-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha14/#/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.8.0-alpha14/#/elements/vaadin-list-box).\n- `<vaadin-menu-bar-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha14/#/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
|
{
|