@vaadin/a11y-base 24.1.0-alpha4 → 24.1.0-alpha6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/a11y-base",
3
- "version": "24.1.0-alpha4",
3
+ "version": "24.1.0-alpha6",
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.1.0-alpha4",
35
+ "@vaadin/component-base": "24.1.0-alpha6",
36
36
  "lit": "^2.0.0"
37
37
  },
38
38
  "devDependencies": {
@@ -40,5 +40,5 @@
40
40
  "@vaadin/testing-helpers": "^0.4.0",
41
41
  "sinon": "^13.0.2"
42
42
  },
43
- "gitHead": "4494259f3b7532acb604a3048d5b29a4e14b9ca5"
43
+ "gitHead": "823673f238b8d5705d475d0b355864183646ce44"
44
44
  }
@@ -4,6 +4,12 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
7
+ /**
8
+ * Returns the actually focused element by traversing shadow
9
+ * trees recursively to ensure it's the leaf element.
10
+ */
11
+ export declare function getDeepActiveElement(): Element;
12
+
7
13
  /**
8
14
  * Returns true if the window has received a keydown
9
15
  * event since the last mousedown event.
@@ -26,6 +26,20 @@ window.addEventListener(
26
26
  { capture: true },
27
27
  );
28
28
 
29
+ /**
30
+ * Returns the actually focused element by traversing shadow
31
+ * trees recursively to ensure it's the leaf element.
32
+ *
33
+ * @return {Element}
34
+ */
35
+ export function getDeepActiveElement() {
36
+ let host = document.activeElement || document.body;
37
+ while (host.shadowRoot && host.shadowRoot.activeElement) {
38
+ host = host.shadowRoot.activeElement;
39
+ }
40
+ return host;
41
+ }
42
+
29
43
  /**
30
44
  * Returns true if the window has received a keydown
31
45
  * event since the last mousedown event.