@vaadin/component-base 23.3.28 → 23.3.30
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 +1 -1
- package/src/focus-utils.d.ts +0 -8
- package/src/focus-utils.js +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.30",
|
|
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": "53b2b27a0fc10b9fd008bc9112f5290221fbb184"
|
|
46
46
|
}
|
package/src/element-mixin.js
CHANGED
package/src/focus-utils.d.ts
CHANGED
|
@@ -49,11 +49,3 @@ export declare function isElementFocused(element: HTMLElement): boolean;
|
|
|
49
49
|
* The method traverses nodes in shadow DOM trees too if any.
|
|
50
50
|
*/
|
|
51
51
|
export declare function getFocusableElements(element: HTMLElement): HTMLElement[];
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Returns a closest focusable ancestor of an element,
|
|
55
|
-
* or an element itself in case if it's focusable.
|
|
56
|
-
*
|
|
57
|
-
* The method traverses nodes in shadow DOM trees too if any.
|
|
58
|
-
*/
|
|
59
|
-
export declare function getClosestFocusable(element: HTMLElement): HTMLElement | undefined;
|
package/src/focus-utils.js
CHANGED
|
@@ -260,43 +260,3 @@ export function getFocusableElements(element) {
|
|
|
260
260
|
}
|
|
261
261
|
return focusableElements;
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Returns an ancestor for the given node.
|
|
266
|
-
*
|
|
267
|
-
* @param {Node} node
|
|
268
|
-
* @return {Node}
|
|
269
|
-
* @private
|
|
270
|
-
*/
|
|
271
|
-
function getAncestor(node) {
|
|
272
|
-
if (node.nodeType === Node.ELEMENT_NODE && node.assignedSlot) {
|
|
273
|
-
return node.assignedSlot;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if (node instanceof ShadowRoot) {
|
|
277
|
-
return node.host;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return node.parentNode;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Returns a closest focusable ancestor of an element,
|
|
285
|
-
* or an element itself in case if it's focusable.
|
|
286
|
-
*
|
|
287
|
-
* The method traverses nodes in shadow DOM trees too if any.
|
|
288
|
-
*
|
|
289
|
-
* @param {HTMLElement} element
|
|
290
|
-
* @return {HTMLElement | undefined}
|
|
291
|
-
*/
|
|
292
|
-
export function getClosestFocusable(element) {
|
|
293
|
-
let current = element;
|
|
294
|
-
|
|
295
|
-
while (current !== document.body) {
|
|
296
|
-
if (current.nodeType === Node.ELEMENT_NODE && isElementFocusable(current)) {
|
|
297
|
-
return current;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
current = getAncestor(current);
|
|
301
|
-
}
|
|
302
|
-
}
|