@vaadin/field-base 23.0.1 → 23.0.4
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 +3 -3
- package/src/shadow-focus-mixin.js +8 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/component-base": "^23.0.
|
|
35
|
+
"@vaadin/component-base": "^23.0.4",
|
|
36
36
|
"lit": "^2.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
41
41
|
"sinon": "^9.2.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "d8db2046661c42fb5aac09ed683b500bf4613b26"
|
|
44
44
|
}
|
|
@@ -31,7 +31,7 @@ export const ShadowFocusMixin = (superClass) =>
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Override an event listener from `KeyboardMixin`
|
|
34
|
-
* to prevent
|
|
34
|
+
* to prevent focusing the host element on Shift Tab.
|
|
35
35
|
* @param {KeyboardEvent} event
|
|
36
36
|
* @protected
|
|
37
37
|
* @override
|
|
@@ -39,13 +39,10 @@ export const ShadowFocusMixin = (superClass) =>
|
|
|
39
39
|
_onKeyDown(event) {
|
|
40
40
|
super._onKeyDown(event);
|
|
41
41
|
|
|
42
|
-
// When focus moves with Shift + Tab,
|
|
43
|
-
//
|
|
42
|
+
// When focus moves with Shift + Tab, skip focusing the host element
|
|
43
|
+
// by focusing it before the default browser focus handling runs
|
|
44
44
|
if (!event.defaultPrevented && event.keyCode === 9 && event.shiftKey) {
|
|
45
|
-
this._isShiftTabbing = true;
|
|
46
45
|
HTMLElement.prototype.focus.apply(this);
|
|
47
|
-
this._setFocused(false);
|
|
48
|
-
setTimeout(() => (this._isShiftTabbing = false), 0);
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
|
|
@@ -61,13 +58,13 @@ export const ShadowFocusMixin = (superClass) =>
|
|
|
61
58
|
if (!this.disabled && this.focusElement) {
|
|
62
59
|
const path = event.composedPath();
|
|
63
60
|
|
|
64
|
-
// When focus moves
|
|
65
|
-
|
|
61
|
+
// When focus moves to the host element itself, then delegate it to the focusElement
|
|
62
|
+
// This should only move focus when using keyboard navigation, for clicks we don't want to interfere,
|
|
63
|
+
// for example when the user tries to select some text
|
|
64
|
+
if (path[0] === this && this._keyboardActive) {
|
|
66
65
|
this.focusElement.focus();
|
|
67
|
-
return true;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
if (path.includes(this.focusElement)) {
|
|
67
|
+
if (path[0] === this || path.includes(this.focusElement)) {
|
|
71
68
|
return true;
|
|
72
69
|
}
|
|
73
70
|
}
|