@vaadin/field-base 24.8.9 → 24.8.11
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 +6 -6
- package/src/clear-button-mixin.js +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "24.8.
|
|
3
|
+
"version": "24.8.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/a11y-base": "~24.8.
|
|
36
|
-
"@vaadin/component-base": "~24.8.
|
|
35
|
+
"@vaadin/a11y-base": "~24.8.11",
|
|
36
|
+
"@vaadin/component-base": "~24.8.11",
|
|
37
37
|
"lit": "^3.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@vaadin/chai-plugins": "~24.8.
|
|
41
|
-
"@vaadin/test-runner-commands": "~24.8.
|
|
40
|
+
"@vaadin/chai-plugins": "~24.8.11",
|
|
41
|
+
"@vaadin/test-runner-commands": "~24.8.11",
|
|
42
42
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
43
43
|
"sinon": "^18.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "debf45903bade9948f7880e8615f92884ee98fb2"
|
|
46
46
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { isElementFocused } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
6
7
|
import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
7
8
|
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
8
9
|
import { InputMixin } from './input-mixin.js';
|
|
@@ -71,7 +72,10 @@ export const ClearButtonMixin = (superclass) =>
|
|
|
71
72
|
* @protected
|
|
72
73
|
*/
|
|
73
74
|
_onClearButtonMouseDown(event) {
|
|
74
|
-
|
|
75
|
+
if (this._shouldKeepFocusOnClearMousedown()) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
}
|
|
78
|
+
|
|
75
79
|
if (!isTouch) {
|
|
76
80
|
this.inputElement.focus();
|
|
77
81
|
}
|
|
@@ -109,4 +113,17 @@ export const ClearButtonMixin = (superclass) =>
|
|
|
109
113
|
this.inputElement.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
|
110
114
|
this.inputElement.dispatchEvent(new Event('change', { bubbles: true }));
|
|
111
115
|
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Whether to keep focus inside the field on clear button
|
|
119
|
+
* mousedown. By default, if the field has focus, it gets
|
|
120
|
+
* preserved using `preventDefault()` on mousedown event
|
|
121
|
+
* in order to avoid blur and change events.
|
|
122
|
+
*
|
|
123
|
+
* @protected
|
|
124
|
+
* @return {boolean}
|
|
125
|
+
*/
|
|
126
|
+
_shouldKeepFocusOnClearMousedown() {
|
|
127
|
+
return isElementFocused(this.inputElement);
|
|
128
|
+
}
|
|
112
129
|
};
|