@celestia-island/hikari 0.55.172 → 0.55.174
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
|
@@ -66,3 +66,35 @@ describe("HHoverRevealAction touch reveal modes", () => {
|
|
|
66
66
|
expect(el.className).not.toContain("is-revealed");
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
|
+
|
|
70
|
+
describe("HHoverRevealAction bare-click robustness", () => {
|
|
71
|
+
it("reveals on mousedown even without a preceding hover (synthetic clicks)", async () => {
|
|
72
|
+
// Test drivers dispatch a click straight at the extension's coordinates
|
|
73
|
+
// with no mouseenter; without the mousedown reveal the extension stays
|
|
74
|
+
// pointer-events:none and the click passes through to the page below.
|
|
75
|
+
const { el } = await mountHost();
|
|
76
|
+
expect(el.className).not.toContain("is-revealed");
|
|
77
|
+
el.dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
|
|
78
|
+
await Promise.resolve();
|
|
79
|
+
expect(el.className).toContain("is-revealed");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("keeps the touch suppress window authoritative over mousedown", async () => {
|
|
83
|
+
// Touch interactions fire an emulated mousedown after the tap; during
|
|
84
|
+
// the touch linger the touch path owns the state and a stray emulated
|
|
85
|
+
// mousedown must not re-reveal (which would clear the hide timer).
|
|
86
|
+
vi.useFakeTimers();
|
|
87
|
+
const { el } = await mountHost();
|
|
88
|
+
el.dispatchEvent(new Event("touchstart", { bubbles: true }));
|
|
89
|
+
el.dispatchEvent(new Event("touchend", { bubbles: true }));
|
|
90
|
+
await Promise.resolve();
|
|
91
|
+
expect(el.className).toContain("is-revealed");
|
|
92
|
+
// Emulated mousedown while the touch linger owns the reveal.
|
|
93
|
+
el.dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
|
|
94
|
+
// After the linger expires the extension hides — the mousedown must
|
|
95
|
+
// not have reset the hide timer (i.e. must have been suppressed).
|
|
96
|
+
vi.advanceTimersByTime(3100);
|
|
97
|
+
await Promise.resolve();
|
|
98
|
+
expect(el.className).not.toContain("is-revealed");
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -107,6 +107,17 @@ export default defineComponent({
|
|
|
107
107
|
reveal();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
function onMouseDown() {
|
|
111
|
+
// Bare synthetic clicks (test drivers dispatching a click at the
|
|
112
|
+
// extension's coordinates without a preceding hover move) land while
|
|
113
|
+
// the extension is still pointer-events:none — the click passes
|
|
114
|
+
// through to whatever sits underneath and the action never fires.
|
|
115
|
+
// A mousedown anywhere on the host reveals the extension first; the
|
|
116
|
+
// click that follows in the same interaction then finds it live.
|
|
117
|
+
if (Date.now() < suppressMouseUntil) return;
|
|
118
|
+
reveal();
|
|
119
|
+
}
|
|
120
|
+
|
|
110
121
|
function onMouseLeave() {
|
|
111
122
|
if (Date.now() < suppressMouseUntil) return;
|
|
112
123
|
scheduleHide(props.hideDelay);
|
|
@@ -133,6 +144,7 @@ export default defineComponent({
|
|
|
133
144
|
"data-placement": props.placement,
|
|
134
145
|
onMouseenter: onMouseEnter,
|
|
135
146
|
onMouseleave: onMouseLeave,
|
|
147
|
+
onMousedown: onMouseDown,
|
|
136
148
|
onTouchstart: onTouchStart,
|
|
137
149
|
onTouchend: onTouchEnd,
|
|
138
150
|
onTouchcancel: onTouchEnd,
|