@vaadin/component-base 23.1.3 → 23.1.6
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 +2 -2
- package/src/active-mixin.js +11 -14
- package/src/element-mixin.js +1 -1
- package/src/focus-trap-controller.js +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
43
43
|
"sinon": "^13.0.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b356bcba208f6569d3d85ac11795c3e736adce85"
|
|
46
46
|
}
|
package/src/active-mixin.js
CHANGED
|
@@ -79,21 +79,18 @@ export const ActiveMixin = (superclass) =>
|
|
|
79
79
|
|
|
80
80
|
if (this._shouldSetActive(event) && this._activeKeys.includes(event.key)) {
|
|
81
81
|
this._setActive(true);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Removes the `active` attribute from the element if the activation key is released.
|
|
87
|
-
*
|
|
88
|
-
* @param {KeyboardEvent} event
|
|
89
|
-
* @protected
|
|
90
|
-
* @override
|
|
91
|
-
*/
|
|
92
|
-
_onKeyUp(event) {
|
|
93
|
-
super._onKeyUp(event);
|
|
94
82
|
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
// Element can become hidden before the `keyup` event, e.g. on button click.
|
|
84
|
+
// Use document listener to ensure `active` attribute is removed correctly.
|
|
85
|
+
document.addEventListener(
|
|
86
|
+
'keyup',
|
|
87
|
+
(e) => {
|
|
88
|
+
if (this._activeKeys.includes(e.key)) {
|
|
89
|
+
this._setActive(false);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{ once: true },
|
|
93
|
+
);
|
|
97
94
|
}
|
|
98
95
|
}
|
|
99
96
|
|
package/src/element-mixin.js
CHANGED
|
@@ -125,7 +125,11 @@ export class FocusTrapController {
|
|
|
125
125
|
const step = backward ? -1 : 1;
|
|
126
126
|
const currentIndex = this.__focusedElementIndex;
|
|
127
127
|
const nextIndex = (focusableElements.length + currentIndex + step) % focusableElements.length;
|
|
128
|
-
focusableElements[nextIndex]
|
|
128
|
+
const element = focusableElements[nextIndex];
|
|
129
|
+
element.focus();
|
|
130
|
+
if (element.localName === 'input') {
|
|
131
|
+
element.select();
|
|
132
|
+
}
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
/**
|