@aurodesignsystem/auro-library 4.4.0 → 4.5.0
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
# [4.5.0](https://github.com/AlaskaAirlines/auro-library/compare/v4.4.1...v4.5.0) (2025-05-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add an advanced `iterate()` to test the given action AND a11y [#159](https://github.com/AlaskaAirlines/auro-library/issues/159) ([0d1734c](https://github.com/AlaskaAirlines/auro-library/commit/0d1734ca3403b51962412444f8264b088482af21))
|
|
9
|
+
|
|
10
|
+
## [4.4.1](https://github.com/AlaskaAirlines/auro-library/compare/v4.4.0...v4.4.1) (2025-05-01)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* allow typing in space on Input Element ([7d0e250](https://github.com/AlaskaAirlines/auro-library/commit/7d0e25053bbfe52f5038224f82e60054facfef81))
|
|
16
|
+
|
|
3
17
|
# [4.4.0](https://github.com/AlaskaAirlines/auro-library/compare/v4.3.1...v4.4.0) (2025-04-30)
|
|
4
18
|
|
|
5
19
|
|
package/package.json
CHANGED
|
@@ -467,7 +467,9 @@ export default class AuroFloatingUI {
|
|
|
467
467
|
case 'keydown':
|
|
468
468
|
// Support both Enter and Space keys for accessibility
|
|
469
469
|
// Space is included as it's expected behavior for interactive elements
|
|
470
|
-
|
|
470
|
+
|
|
471
|
+
const origin = event.composedPath()[0];
|
|
472
|
+
if (event.key === 'Enter' || ((!origin || origin.tagName !== "INPUT") && event.key === ' ')) {
|
|
471
473
|
event.preventDefault(); // Prevent page scroll on space
|
|
472
474
|
this.handleClick();
|
|
473
475
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
|
|
3
|
+
let originalIt;
|
|
4
|
+
async function checkElementAccessibility(element) {
|
|
5
|
+
// test only when this element is meaningful.
|
|
6
|
+
if (element.children.length || element.attributes.length) {
|
|
7
|
+
await expect(element).to.be.accessible();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function aIt(desc, action) {
|
|
12
|
+
const actionWithA11y = async () => {
|
|
13
|
+
const result = await action();
|
|
14
|
+
|
|
15
|
+
let rootElement;
|
|
16
|
+
if (typeof result === 'string') {
|
|
17
|
+
rootElement = document.querySelector(result);
|
|
18
|
+
} else if (result instanceof Element) {
|
|
19
|
+
rootElement = result;
|
|
20
|
+
} else {
|
|
21
|
+
// fallback incase `action()` didnt return the created node.
|
|
22
|
+
// The framework injdect any elements that are created during `action()` to first `div` layer under `body`.
|
|
23
|
+
// this `div` will get cleared after the iteration.
|
|
24
|
+
rootElement = document.body.querySelector('div');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (rootElement) {
|
|
28
|
+
await checkElementAccessibility(rootElement);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const children = [...document.body.children];
|
|
32
|
+
for (let child of children) {
|
|
33
|
+
if (child !== rootElement) {
|
|
34
|
+
// when the iteration's element uses `floatingUI`, there will be an extra child under `body`.
|
|
35
|
+
if (
|
|
36
|
+
child.hasAttribute("auro-dropdownbib") ||
|
|
37
|
+
child.hasAttribute("auro-floater-bib")
|
|
38
|
+
) {
|
|
39
|
+
// test `floatingUI.bib`
|
|
40
|
+
await checkElementAccessibility(child);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
originalIt(desc, actionWithA11y);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Usage Example
|
|
51
|
+
*
|
|
52
|
+
* import { getAccessibleIt } from "@aurodesignsystem/auro-library/scripts/test-plugin/iterateWithA11Check.mjs";
|
|
53
|
+
*
|
|
54
|
+
* it = getAccessibleIt();
|
|
55
|
+
*
|
|
56
|
+
* OR
|
|
57
|
+
*
|
|
58
|
+
* import { getAccessibleIt } from "@aurodesignsystem/auro-library/scripts/test-plugin/iterateWithA11Check.mjs";
|
|
59
|
+
*
|
|
60
|
+
* aIt = getAccessibleIt();
|
|
61
|
+
*
|
|
62
|
+
* describe('test', () => {
|
|
63
|
+
* aIt('description', () => {
|
|
64
|
+
* ...
|
|
65
|
+
* }
|
|
66
|
+
* });
|
|
67
|
+
*/
|
|
68
|
+
export function getAccessibleIt() {
|
|
69
|
+
originalIt ??= it;
|
|
70
|
+
return aIt;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Usage Example
|
|
75
|
+
*
|
|
76
|
+
* import { useAccessibleIt } from "@aurodesignsystem/auro-library/scripts/test-plugin/iterateWithA11Check.mjs";
|
|
77
|
+
* useAccessibleIt();
|
|
78
|
+
*/
|
|
79
|
+
export function useAccessibleIt() {
|
|
80
|
+
originalIt ??= it;
|
|
81
|
+
it = aIt;
|
|
82
|
+
}
|