@vaadin/a11y-base 24.2.4 → 24.2.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 +3 -3
- 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/a11y-base",
|
|
3
|
-
"version": "24.2.
|
|
3
|
+
"version": "24.2.6",
|
|
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": "~24.2.
|
|
35
|
+
"@vaadin/component-base": "~24.2.6",
|
|
36
36
|
"lit": "^2.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@vaadin/testing-helpers": "^0.5.0",
|
|
41
41
|
"sinon": "^13.0.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "0d105dd0eff818ab9c82c8443b92a1e15ac0e41a"
|
|
44
44
|
}
|
package/src/focus-utils.d.ts
CHANGED
|
@@ -55,11 +55,3 @@ export declare function isElementFocused(element: HTMLElement): boolean;
|
|
|
55
55
|
* The method traverses nodes in shadow DOM trees too if any.
|
|
56
56
|
*/
|
|
57
57
|
export declare function getFocusableElements(element: HTMLElement): HTMLElement[];
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Returns a closest focusable ancestor of an element,
|
|
61
|
-
* or an element itself in case if it's focusable.
|
|
62
|
-
*
|
|
63
|
-
* The method traverses nodes in shadow DOM trees too if any.
|
|
64
|
-
*/
|
|
65
|
-
export declare function getClosestFocusable(element: HTMLElement): HTMLElement | undefined;
|
package/src/focus-utils.js
CHANGED
|
@@ -274,43 +274,3 @@ export function getFocusableElements(element) {
|
|
|
274
274
|
}
|
|
275
275
|
return focusableElements;
|
|
276
276
|
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Returns an ancestor for the given node.
|
|
280
|
-
*
|
|
281
|
-
* @param {Node} node
|
|
282
|
-
* @return {Node}
|
|
283
|
-
* @private
|
|
284
|
-
*/
|
|
285
|
-
function getAncestor(node) {
|
|
286
|
-
if (node.nodeType === Node.ELEMENT_NODE && node.assignedSlot) {
|
|
287
|
-
return node.assignedSlot;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if (node instanceof ShadowRoot) {
|
|
291
|
-
return node.host;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return node.parentNode;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Returns a closest focusable ancestor of an element,
|
|
299
|
-
* or an element itself in case if it's focusable.
|
|
300
|
-
*
|
|
301
|
-
* The method traverses nodes in shadow DOM trees too if any.
|
|
302
|
-
*
|
|
303
|
-
* @param {HTMLElement} element
|
|
304
|
-
* @return {HTMLElement | undefined}
|
|
305
|
-
*/
|
|
306
|
-
export function getClosestFocusable(element) {
|
|
307
|
-
let current = element;
|
|
308
|
-
|
|
309
|
-
while (current !== document.body) {
|
|
310
|
-
if (current.nodeType === Node.ELEMENT_NODE && isElementFocusable(current)) {
|
|
311
|
-
return current;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
current = getAncestor(current);
|
|
315
|
-
}
|
|
316
|
-
}
|