@aurodesignsystem/auro-library 4.4.1 → 5.0.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,24 @@
1
1
  # Semantic Release Automated Changelog
2
2
 
3
+ # [5.0.0](https://github.com/AlaskaAirlines/auro-library/compare/v4.5.0...v5.0.0) (2025-05-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * update positioning strategy and remove dom node transportation from FloatingUI ([3e01ab2](https://github.com/AlaskaAirlines/auro-library/commit/3e01ab2e8cadfa76d7d057abc6626b7b09ef568f))
9
+
10
+
11
+ ### BREAKING CHANGES
12
+
13
+ * this changes the fundamental strategy for implementing FloatingUI and will require accommodating changes in consuming code to work correctly
14
+
15
+ # [4.5.0](https://github.com/AlaskaAirlines/auro-library/compare/v4.4.1...v4.5.0) (2025-05-15)
16
+
17
+
18
+ ### Features
19
+
20
+ * 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))
21
+
3
22
  ## [4.4.1](https://github.com/AlaskaAirlines/auro-library/compare/v4.4.0...v4.4.1) (2025-05-01)
4
23
 
5
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-library",
3
- "version": "4.4.1",
3
+ "version": "5.0.0",
4
4
  "description": "This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -152,6 +152,7 @@ export default class AuroFloatingUI {
152
152
 
153
153
  // Compute the position of the bib
154
154
  computePosition(this.element.trigger, this.element.bib, {
155
+ strategy: this.element.floaterConfig?.strategy || 'fixed',
155
156
  placement: this.element.floaterConfig?.placement,
156
157
  middleware: middleware || []
157
158
  }).then(({ x, y }) => { // eslint-disable-line id-length
@@ -589,8 +590,6 @@ export default class AuroFloatingUI {
589
590
  this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
590
591
  }
591
592
 
592
- document.body.append(this.element.bib);
593
-
594
593
  this.regenerateBibId();
595
594
  this.handleTriggerTabIndex();
596
595
 
@@ -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
+ }