@vaadin/a11y-base 25.3.0 → 25.3.2

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/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { DisabledMixin } from './src/disabled-mixin.js';
5
5
  export { FieldAriaController } from './src/field-aria-controller.js';
6
6
  export { FocusMixin } from './src/focus-mixin.js';
7
7
  export {
8
+ getFocusableElements,
8
9
  getTabbableElements,
9
10
  isElementFocusable,
10
11
  isElementFocused,
package/index.js CHANGED
@@ -7,6 +7,7 @@ export { FocusMixin } from './src/focus-mixin.js';
7
7
  export { FocusTrapController } from './src/focus-trap-controller.js';
8
8
  export { FocusRestorationController } from './src/focus-restoration-controller.js';
9
9
  export {
10
+ getFocusableElements,
10
11
  getTabbableElements,
11
12
  isElementFocusable,
12
13
  isElementFocused,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/a11y-base",
3
- "version": "25.3.0",
3
+ "version": "25.3.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,15 +32,15 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@open-wc/dedupe-mixin": "^1.3.0",
35
- "@vaadin/component-base": "~25.3.0",
35
+ "@vaadin/component-base": "~25.3.2",
36
36
  "lit": "^3.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@vaadin/chai-plugins": "~25.3.0",
40
- "@vaadin/test-runner-commands": "~25.3.0",
39
+ "@vaadin/chai-plugins": "~25.3.2",
40
+ "@vaadin/test-runner-commands": "~25.3.2",
41
41
  "@vaadin/testing-helpers": "^2.0.0",
42
42
  "sinon": "^22.0.0"
43
43
  },
44
44
  "customElements": "custom-elements.json",
45
- "gitHead": "4133747243c03bf544f6e82cc2ec9f295aaccd65"
45
+ "gitHead": "3f75254a3f77da3977cb79a77f549f37b8a5d54e"
46
46
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
7
7
  import { FocusMixin } from './focus-mixin.js';
8
+ import { isElementFocused } from './focus-utils.js';
8
9
  import { TabindexMixin } from './tabindex-mixin.js';
9
10
 
10
11
  /**
@@ -82,6 +83,11 @@ const DelegateFocusMixinImplementation = (superclass) => {
82
83
  // Only forward the native option, `focusVisible` is handled below.
83
84
  this.focusElement.focus({ preventScroll: !!options?.preventScroll });
84
85
 
86
+ // Focus did not move, e.g. while hidden in a closed dialog
87
+ if (!isElementFocused(this.focusElement)) {
88
+ return;
89
+ }
90
+
85
91
  // Set focus-ring attribute on programmatic focus by default
86
92
  // unless explicitly disabled by `{ focusVisible: false }`.
87
93
  if (options?.focusVisible !== false) {
@@ -56,3 +56,13 @@ export declare function isElementFocused(element: HTMLElement): boolean;
56
56
  * The method traverses nodes in shadow DOM trees too if any.
57
57
  */
58
58
  export declare function getTabbableElements(element: HTMLElement): HTMLElement[];
59
+
60
+ /**
61
+ * Returns a tab-ordered array of focusable elements for a root element.
62
+ * The resulting array will include the root element if it is focusable.
63
+ *
64
+ * The method traverses nodes in shadow DOM trees too if any.
65
+ *
66
+ * @deprecated This function is deprecated and will be removed in Vaadin 26. Use `getTabbableElements` instead.
67
+ */
68
+ export declare function getFocusableElements(element: HTMLElement): HTMLElement[];
@@ -277,3 +277,17 @@ export function getTabbableElements(element) {
277
277
  }
278
278
  return focusableElements;
279
279
  }
280
+
281
+ /**
282
+ * Returns a tab-ordered array of focusable elements for a root element.
283
+ * The resulting array will include the root element if it is focusable.
284
+ *
285
+ * The method traverses nodes in shadow DOM trees too if any.
286
+ *
287
+ * @deprecated This function is deprecated and will be removed in Vaadin 26. Use `getTabbableElements` instead.
288
+ * @param {HTMLElement} element
289
+ * @return {HTMLElement[]}
290
+ */
291
+ export function getFocusableElements(element) {
292
+ return getTabbableElements(element);
293
+ }