@vaadin/a11y-base 24.8.0-alpha13 → 24.8.0-alpha15
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/a11y-base",
|
|
3
|
-
"version": "24.8.0-
|
|
3
|
+
"version": "24.8.0-alpha15",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/component-base": "24.8.0-
|
|
35
|
+
"@vaadin/component-base": "24.8.0-alpha15",
|
|
36
36
|
"lit": "^3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@vaadin/chai-plugins": "24.8.0-
|
|
40
|
-
"@vaadin/test-runner-commands": "24.8.0-
|
|
39
|
+
"@vaadin/chai-plugins": "24.8.0-alpha15",
|
|
40
|
+
"@vaadin/test-runner-commands": "24.8.0-alpha15",
|
|
41
41
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
42
42
|
"sinon": "^18.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d2d0d1bb5efa3a439e568c1693d2fee3cc18fc67"
|
|
45
45
|
}
|
|
@@ -30,6 +30,14 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @return {boolean}
|
|
35
|
+
* @protected
|
|
36
|
+
*/
|
|
37
|
+
get _tabNavigation() {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
/** @protected */
|
|
34
42
|
focus() {
|
|
35
43
|
const items = this._getItems();
|
|
@@ -67,7 +75,7 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
67
75
|
return;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
const { key } = event;
|
|
78
|
+
const { key, shiftKey } = event;
|
|
71
79
|
const items = this._getItems() || [];
|
|
72
80
|
const currentIdx = items.indexOf(this.focused);
|
|
73
81
|
|
|
@@ -77,10 +85,10 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
77
85
|
const isRTL = !this._vertical && this.getAttribute('dir') === 'rtl';
|
|
78
86
|
const dirIncrement = isRTL ? -1 : 1;
|
|
79
87
|
|
|
80
|
-
if (this.
|
|
88
|
+
if (this.__isPrevKeyPressed(key, shiftKey)) {
|
|
81
89
|
increment = -dirIncrement;
|
|
82
90
|
idx = currentIdx - dirIncrement;
|
|
83
|
-
} else if (this.
|
|
91
|
+
} else if (this.__isNextKeyPressed(key, shiftKey)) {
|
|
84
92
|
increment = dirIncrement;
|
|
85
93
|
idx = currentIdx + dirIncrement;
|
|
86
94
|
} else if (key === 'Home') {
|
|
@@ -93,6 +101,17 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
93
101
|
|
|
94
102
|
idx = this._getAvailableIndex(items, idx, increment, (item) => !isElementHidden(item));
|
|
95
103
|
|
|
104
|
+
if (
|
|
105
|
+
this._tabNavigation &&
|
|
106
|
+
key === 'Tab' &&
|
|
107
|
+
((idx > currentIdx && event.shiftKey) || (idx < currentIdx && !event.shiftKey))
|
|
108
|
+
) {
|
|
109
|
+
// Prevent "roving tabindex" logic and let the normal Tab behavior if
|
|
110
|
+
// - currently on the first focusable item and Shift + Tab is pressed,
|
|
111
|
+
// - currently on the last focusable item and Tab is pressed.
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
96
115
|
if (idx >= 0) {
|
|
97
116
|
event.preventDefault();
|
|
98
117
|
this._focus(idx, true);
|
|
@@ -101,20 +120,30 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
101
120
|
|
|
102
121
|
/**
|
|
103
122
|
* @param {string} key
|
|
123
|
+
* @param {boolean} shiftKey
|
|
104
124
|
* @return {boolean}
|
|
105
125
|
* @private
|
|
106
126
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
127
|
+
__isPrevKeyPressed(key, shiftKey) {
|
|
128
|
+
if (this._vertical) {
|
|
129
|
+
return key === 'ArrowUp';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return key === 'ArrowLeft' || (this._tabNavigation && key === 'Tab' && shiftKey);
|
|
109
133
|
}
|
|
110
134
|
|
|
111
135
|
/**
|
|
112
136
|
* @param {string} key
|
|
137
|
+
* @param {boolean} shiftKey
|
|
113
138
|
* @return {boolean}
|
|
114
139
|
* @private
|
|
115
140
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
141
|
+
__isNextKeyPressed(key, shiftKey) {
|
|
142
|
+
if (this._vertical) {
|
|
143
|
+
return key === 'ArrowDown';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return key === 'ArrowRight' || (this._tabNavigation && key === 'Tab' && !shiftKey);
|
|
118
147
|
}
|
|
119
148
|
|
|
120
149
|
/**
|