@vaadin/a11y-base 24.6.5 → 24.7.0-alpha10
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 +5 -5
- package/src/active-mixin.d.ts +1 -1
- package/src/active-mixin.js +1 -1
- package/src/announce.d.ts +1 -1
- package/src/announce.js +1 -1
- package/src/aria-id-reference.d.ts +1 -1
- package/src/aria-id-reference.js +1 -1
- package/src/aria-modal-controller.d.ts +1 -1
- package/src/aria-modal-controller.js +1 -1
- package/src/delegate-focus-mixin.d.ts +1 -1
- package/src/delegate-focus-mixin.js +1 -1
- package/src/disabled-mixin.d.ts +1 -1
- package/src/disabled-mixin.js +1 -1
- package/src/field-aria-controller.d.ts +1 -1
- package/src/field-aria-controller.js +1 -1
- package/src/focus-mixin.d.ts +1 -1
- package/src/focus-mixin.js +1 -1
- package/src/focus-restoration-controller.d.ts +1 -1
- package/src/focus-restoration-controller.js +1 -1
- package/src/focus-trap-controller.d.ts +1 -1
- package/src/focus-trap-controller.js +1 -1
- package/src/focus-utils.d.ts +1 -1
- package/src/focus-utils.js +8 -1
- package/src/keyboard-direction-mixin.d.ts +7 -1
- package/src/keyboard-direction-mixin.js +14 -2
- package/src/keyboard-mixin.d.ts +1 -1
- package/src/keyboard-mixin.js +1 -1
- package/src/list-mixin.d.ts +1 -1
- package/src/list-mixin.js +1 -10
- package/src/styles/sr-only-styles.d.ts +1 -1
- package/src/styles/sr-only-styles.js +1 -1
- package/src/tabindex-mixin.d.ts +1 -1
- package/src/tabindex-mixin.js +35 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/a11y-base",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.7.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/component-base": "
|
|
35
|
+
"@vaadin/component-base": "24.7.0-alpha10",
|
|
36
36
|
"lit": "^3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@vaadin/chai-plugins": "
|
|
40
|
-
"@vaadin/test-runner-commands": "
|
|
39
|
+
"@vaadin/chai-plugins": "24.7.0-alpha10",
|
|
40
|
+
"@vaadin/test-runner-commands": "24.7.0-alpha10",
|
|
41
41
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
42
42
|
"sinon": "^18.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "c0f8933df2a6a40648d3fb9cfbae6bbf86a8aa90"
|
|
45
45
|
}
|
package/src/active-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/active-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { addListener } from '@vaadin/component-base/src/gestures.js';
|
package/src/announce.d.ts
CHANGED
package/src/announce.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2022 -
|
|
3
|
+
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { animationFrame } from '@vaadin/component-base/src/async.js';
|
package/src/aria-id-reference.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
package/src/disabled-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/disabled-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { removeAriaIDReference, restoreGeneratedAriaIDReference, setAriaIDReference } from './aria-id-reference.js';
|
package/src/focus-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/focus-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { getDeepActiveElement } from './focus-utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { getFocusableElements, isElementFocused } from './focus-utils.js';
|
package/src/focus-utils.d.ts
CHANGED
package/src/focus-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -145,6 +145,13 @@ function sortElementsByTabIndex(elements) {
|
|
|
145
145
|
* @return {boolean}
|
|
146
146
|
*/
|
|
147
147
|
export function isElementHidden(element) {
|
|
148
|
+
if (element.checkVisibility) {
|
|
149
|
+
return !element.checkVisibility({ visibilityProperty: true });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// TODO: checkVisibility is supported only from Safari 17.4, so we still need to
|
|
153
|
+
// keep the custom implementation as a fallback for older versions until Vaadin 25:
|
|
154
|
+
|
|
148
155
|
// `offsetParent` is `null` when the element itself
|
|
149
156
|
// or one of its ancestors is hidden with `display: none`.
|
|
150
157
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2022 -
|
|
3
|
+
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
@@ -38,4 +38,10 @@ export declare class KeyboardDirectionMixinClass {
|
|
|
38
38
|
* Focus the given item. Override this method to add custom logic.
|
|
39
39
|
*/
|
|
40
40
|
protected _focusItem(item: Element, navigating: boolean): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns whether the item is focusable. By default,
|
|
44
|
+
* returns true if the item is not disabled.
|
|
45
|
+
*/
|
|
46
|
+
protected _isItemFocusable(item: Element): boolean;
|
|
41
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2022 -
|
|
3
|
+
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { isElementFocused, isElementHidden } from './focus-utils.js';
|
|
@@ -171,7 +171,7 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
171
171
|
|
|
172
172
|
const item = items[idx];
|
|
173
173
|
|
|
174
|
-
if (
|
|
174
|
+
if (this._isItemFocusable(item) && this.__isMatchingItem(item, condition)) {
|
|
175
175
|
return idx;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -189,4 +189,16 @@ export const KeyboardDirectionMixin = (superclass) =>
|
|
|
189
189
|
__isMatchingItem(item, condition) {
|
|
190
190
|
return typeof condition === 'function' ? condition(item) : true;
|
|
191
191
|
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Returns whether the item is focusable. By default,
|
|
195
|
+
* returns true if the item is not disabled.
|
|
196
|
+
*
|
|
197
|
+
* @param {Element} item
|
|
198
|
+
* @return {boolean}
|
|
199
|
+
* @protected
|
|
200
|
+
*/
|
|
201
|
+
_isItemFocusable(item) {
|
|
202
|
+
return !item.hasAttribute('disabled');
|
|
203
|
+
}
|
|
192
204
|
};
|
package/src/keyboard-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/keyboard-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
package/src/list-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/list-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2017 -
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
@@ -266,15 +266,6 @@ export const ListMixin = (superClass) =>
|
|
|
266
266
|
super._onKeyDown(event);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
/**
|
|
270
|
-
* @param {!Element} item
|
|
271
|
-
* @return {boolean}
|
|
272
|
-
* @protected
|
|
273
|
-
*/
|
|
274
|
-
_isItemHidden(item) {
|
|
275
|
-
return getComputedStyle(item).display === 'none';
|
|
276
|
-
}
|
|
277
|
-
|
|
278
269
|
/**
|
|
279
270
|
* @param {number} idx
|
|
280
271
|
* @protected
|
package/src/tabindex-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/tabindex-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { DisabledMixin } from './disabled-mixin.js';
|
|
@@ -52,6 +52,10 @@ export const TabindexMixin = (superclass) =>
|
|
|
52
52
|
_disabledChanged(disabled, oldDisabled) {
|
|
53
53
|
super._disabledChanged(disabled, oldDisabled);
|
|
54
54
|
|
|
55
|
+
if (this.__shouldAllowFocusWhenDisabled()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
if (disabled) {
|
|
56
60
|
if (this.tabindex !== undefined) {
|
|
57
61
|
this._lastTabIndex = this.tabindex;
|
|
@@ -70,9 +74,39 @@ export const TabindexMixin = (superclass) =>
|
|
|
70
74
|
* @protected
|
|
71
75
|
*/
|
|
72
76
|
_tabindexChanged(tabindex) {
|
|
77
|
+
if (this.__shouldAllowFocusWhenDisabled()) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
if (this.disabled && tabindex !== -1) {
|
|
74
82
|
this._lastTabIndex = tabindex;
|
|
75
83
|
this.tabindex = -1;
|
|
76
84
|
}
|
|
77
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Overrides the native `focus` method in order to prevent
|
|
89
|
+
* focusing the element when it is disabled. Note, setting
|
|
90
|
+
* `tabindex` to -1 does not prevent the element from being
|
|
91
|
+
* programmatically focusable.
|
|
92
|
+
*
|
|
93
|
+
* @protected
|
|
94
|
+
* @override
|
|
95
|
+
*/
|
|
96
|
+
focus() {
|
|
97
|
+
if (!this.disabled || this.__shouldAllowFocusWhenDisabled()) {
|
|
98
|
+
super.focus();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Returns whether the component should be focusable when disabled.
|
|
104
|
+
* Returns false by default.
|
|
105
|
+
*
|
|
106
|
+
* @private
|
|
107
|
+
* @return {boolean}
|
|
108
|
+
*/
|
|
109
|
+
__shouldAllowFocusWhenDisabled() {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
78
112
|
};
|