@vaadin/component-base 23.0.0 → 23.0.1
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/element-mixin.js +8 -1
- package/src/focus-trap-controller.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
43
43
|
"sinon": "^9.2.4"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "05fcc6daa21325753cf528c9c1072ccd8dd1e52e"
|
|
46
46
|
}
|
package/src/element-mixin.js
CHANGED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { setCancelSyntheticClickEvents } from '@polymer/polymer/lib/utils/settings.js';
|
|
6
7
|
import { usageStatistics } from '@vaadin/vaadin-usage-statistics/vaadin-usage-statistics.js';
|
|
7
8
|
import { idlePeriod } from './async.js';
|
|
8
9
|
import { Debouncer, enqueueDebouncer } from './debounce.js';
|
|
9
10
|
import { DirMixin } from './dir-mixin.js';
|
|
10
11
|
|
|
12
|
+
// This setting affects the legacy Polymer gestures which get activated
|
|
13
|
+
// once you import any iron component e.g iron-icon.
|
|
14
|
+
// It has to be explicitly disabled to prevent click issues in iOS + VoiceOver
|
|
15
|
+
// for buttons that are based on `[role=button]` e.g vaadin-button.
|
|
16
|
+
setCancelSyntheticClickEvents(false);
|
|
17
|
+
|
|
11
18
|
window.Vaadin = window.Vaadin || {};
|
|
12
19
|
|
|
13
20
|
/**
|
|
@@ -32,7 +39,7 @@ const registered = new Set();
|
|
|
32
39
|
export const ElementMixin = (superClass) =>
|
|
33
40
|
class VaadinElementMixin extends DirMixin(superClass) {
|
|
34
41
|
static get version() {
|
|
35
|
-
return '23.0.
|
|
42
|
+
return '23.0.1';
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
/** @protected */
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { getFocusableElements, isElementFocused } from './focus-utils.js';
|
|
7
7
|
|
|
8
|
+
const instances = [];
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* A controller for trapping focus within a DOM node.
|
|
10
12
|
*/
|
|
@@ -61,6 +63,8 @@ export class FocusTrapController {
|
|
|
61
63
|
throw new Error('The trap node should have at least one focusable descendant or be focusable itself.');
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
instances.push(this);
|
|
67
|
+
|
|
64
68
|
if (this.__focusedElementIndex === -1) {
|
|
65
69
|
this.__focusableElements[0].focus();
|
|
66
70
|
}
|
|
@@ -72,6 +76,8 @@ export class FocusTrapController {
|
|
|
72
76
|
*/
|
|
73
77
|
releaseFocus() {
|
|
74
78
|
this.__trapNode = null;
|
|
79
|
+
|
|
80
|
+
instances.pop();
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
/**
|
|
@@ -90,6 +96,11 @@ export class FocusTrapController {
|
|
|
90
96
|
return;
|
|
91
97
|
}
|
|
92
98
|
|
|
99
|
+
// Only handle events for the last instance
|
|
100
|
+
if (this !== Array.from(instances).pop()) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
93
104
|
if (event.key === 'Tab') {
|
|
94
105
|
event.preventDefault();
|
|
95
106
|
|