@vaadin/a11y-base 24.4.0-alpha9 → 24.4.0-beta2

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.4.0-alpha9",
3
+ "version": "24.4.0-beta2",
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.4.0-alpha9",
35
+ "@vaadin/component-base": "24.4.0-beta2",
36
36
  "lit": "^3.0.0"
37
37
  },
38
38
  "devDependencies": {
@@ -40,5 +40,5 @@
40
40
  "@vaadin/testing-helpers": "^0.6.0",
41
41
  "sinon": "^13.0.2"
42
42
  },
43
- "gitHead": "effb81abe3c6283a6ec620cc0cee56069af58226"
43
+ "gitHead": "886ab2e7ccb8353ac3b7a42ebb96dfe2d1211556"
44
44
  }
@@ -36,7 +36,7 @@ export const KeyboardDirectionMixin = (superclass) =>
36
36
  if (Array.isArray(items)) {
37
37
  const idx = this._getAvailableIndex(items, 0, null, (item) => !isElementHidden(item));
38
38
  if (idx >= 0) {
39
- items[idx].focus();
39
+ this._focus(idx);
40
40
  }
41
41
  }
42
42
  }
package/src/list-mixin.js CHANGED
@@ -8,6 +8,7 @@ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
8
8
  import { getNormalizedScrollLeft, setNormalizedScrollLeft } from '@vaadin/component-base/src/dir-utils.js';
9
9
  import { getFlattenedElements } from '@vaadin/component-base/src/dom-utils.js';
10
10
  import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
11
+ import { isElementHidden } from './focus-utils.js';
11
12
  import { KeyboardDirectionMixin } from './keyboard-direction-mixin.js';
12
13
 
13
14
  /**
@@ -117,8 +118,15 @@ export const ListMixin = (superClass) =>
117
118
  if (this._observer) {
118
119
  this._observer.flush();
119
120
  }
120
- const firstItem = this.querySelector('[tabindex="0"]') || (this.items ? this.items[0] : null);
121
- this._focusItem(firstItem);
121
+
122
+ const items = Array.isArray(this.items) ? this.items : [];
123
+ const idx = this._getAvailableIndex(items, 0, null, (item) => item.tabIndex === 0 && !isElementHidden(item));
124
+ if (idx >= 0) {
125
+ this._focus(idx);
126
+ } else {
127
+ // Call `KeyboardDirectionMixin` logic to focus first non-disabled item.
128
+ super.focus();
129
+ }
122
130
  }
123
131
 
124
132
  /** @protected */