@aurodesignsystem/auro-library 5.11.2 → 5.11.3
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,12 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
## [5.11.3](https://github.com/AlaskaAirlines/auro-library/compare/v5.11.2...v5.11.3) (2026-03-31)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* correct focus local check for shadow DOM ([e713cfc](https://github.com/AlaskaAirlines/auro-library/commit/e713cfc07f1be4809c97e05af97b89050478e988))
|
|
9
|
+
|
|
3
10
|
## [5.11.2](https://github.com/AlaskaAirlines/auro-library/compare/v5.11.1...v5.11.2) (2026-03-17)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurodesignsystem/auro-library",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.3",
|
|
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",
|
|
@@ -331,11 +331,10 @@ export default class AuroFloatingUI {
|
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
const { activeElement } = document;
|
|
335
334
|
// if focus is still inside of trigger or bib, do not close
|
|
336
335
|
if (
|
|
337
|
-
this.element.
|
|
338
|
-
this.element.
|
|
336
|
+
this.element.matches(":focus") ||
|
|
337
|
+
this.element.matches(":focus-within")
|
|
339
338
|
) {
|
|
340
339
|
return;
|
|
341
340
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { expect } from "@open-wc/testing";
|
|
2
|
+
import sinon from "sinon";
|
|
3
|
+
import AuroFloatingUI from "./floatingUI.mjs";
|
|
4
|
+
|
|
5
|
+
describe("AuroFloatingUI", () => {
|
|
6
|
+
let host;
|
|
7
|
+
let bib;
|
|
8
|
+
let floatingUI;
|
|
9
|
+
let hideBibSpy;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
host = document.createElement("div");
|
|
13
|
+
bib = document.createElement("div");
|
|
14
|
+
host.bib = bib;
|
|
15
|
+
host.triggerChevron = document.createElement("span");
|
|
16
|
+
|
|
17
|
+
document.body.append(host, bib);
|
|
18
|
+
|
|
19
|
+
AuroFloatingUI.isMousePressed = false;
|
|
20
|
+
floatingUI = new AuroFloatingUI(host, "dropdown");
|
|
21
|
+
hideBibSpy = sinon.spy(floatingUI, "hideBib");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
sinon.restore();
|
|
26
|
+
AuroFloatingUI.isMousePressed = false;
|
|
27
|
+
host?.remove();
|
|
28
|
+
bib?.remove();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("does not hide when the host matches focus-within", () => {
|
|
32
|
+
const checkedSelectors = [];
|
|
33
|
+
|
|
34
|
+
sinon.stub(host, "matches").callsFake((selector) => {
|
|
35
|
+
checkedSelectors.push(selector);
|
|
36
|
+
|
|
37
|
+
if (selector === ":focus") {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (selector === ":focus-within") {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
floatingUI.handleFocusLoss();
|
|
49
|
+
|
|
50
|
+
expect(checkedSelectors).to.deep.equal([":focus", ":focus-within"]);
|
|
51
|
+
expect(hideBibSpy.called).to.be.false;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("does not hide when the host matches focus", () => {
|
|
55
|
+
const checkedSelectors = [];
|
|
56
|
+
|
|
57
|
+
sinon.stub(host, "matches").callsFake((selector) => {
|
|
58
|
+
checkedSelectors.push(selector);
|
|
59
|
+
|
|
60
|
+
if (selector === ":focus") {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return false;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
floatingUI.handleFocusLoss();
|
|
68
|
+
|
|
69
|
+
expect(checkedSelectors).to.deep.equal([":focus"]);
|
|
70
|
+
expect(hideBibSpy.called).to.be.false;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("does not hide when the bib is fullscreen", () => {
|
|
74
|
+
const checkedSelectors = [];
|
|
75
|
+
|
|
76
|
+
bib.setAttribute("isfullscreen", "");
|
|
77
|
+
|
|
78
|
+
sinon.stub(host, "matches").callsFake((selector) => {
|
|
79
|
+
checkedSelectors.push(selector);
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
floatingUI.handleFocusLoss();
|
|
84
|
+
|
|
85
|
+
expect(checkedSelectors).to.deep.equal([":focus", ":focus-within"]);
|
|
86
|
+
expect(hideBibSpy.called).to.be.false;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("hides with a keydown event when the host no longer has focus", () => {
|
|
90
|
+
const checkedSelectors = [];
|
|
91
|
+
|
|
92
|
+
sinon.stub(host, "matches").callsFake((selector) => {
|
|
93
|
+
checkedSelectors.push(selector);
|
|
94
|
+
return false;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
floatingUI.handleFocusLoss();
|
|
98
|
+
|
|
99
|
+
expect(checkedSelectors).to.deep.equal([":focus", ":focus-within"]);
|
|
100
|
+
expect(hideBibSpy.calledOnceWithExactly("keydown")).to.be.true;
|
|
101
|
+
});
|
|
102
|
+
});
|