@celestia-island/hikari 0.55.525 → 0.55.527
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/dist/types/components/HkAlert.d.ts +35 -0
- package/package.json +1 -1
- package/src/components/HkAlert.role.test.tsx +17 -0
- package/src/components/HkAlert.tsx +22 -4
- package/src/components/HkAuthHandoff.test.tsx +45 -1
- package/src/components/HkAuthHandoff.tsx +12 -3
- package/src/errorLandingStandalone/error-landing.html +1 -1
|
@@ -34,6 +34,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
34
34
|
type: PropType<HkPad>;
|
|
35
35
|
default: undefined;
|
|
36
36
|
};
|
|
37
|
+
/** Drop this alert's OWN live region (`role` / `aria-live` stay off
|
|
38
|
+
* the root) while keeping the visuals. For an alert rendered INSIDE
|
|
39
|
+
* a container that already owns the live region — e.g. HkAuthHandoff's
|
|
40
|
+
* failed card, which carries `role="alert"` itself and flips in place
|
|
41
|
+
* on a status change. Nesting a second assertive region there makes a
|
|
42
|
+
* flip announce twice (2026-12-02 review, S2). Default true: the
|
|
43
|
+
* standalone alert keeps its semantics, which every other consumer
|
|
44
|
+
* relies on.
|
|
45
|
+
*
|
|
46
|
+
* The name is `ownsLiveRegion`, NOT `ariaLive`: a camelCase prop
|
|
47
|
+
* lowercases to `arialive`, which CONSUMES the fallthrough
|
|
48
|
+
* `aria-live` attribute — a host's `aria-live="off"` would become an
|
|
49
|
+
* interruption instead of a silence request. */
|
|
50
|
+
ownsLiveRegion: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
37
54
|
}>, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
38
55
|
close: () => true;
|
|
39
56
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -67,6 +84,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
84
|
type: PropType<HkPad>;
|
|
68
85
|
default: undefined;
|
|
69
86
|
};
|
|
87
|
+
/** Drop this alert's OWN live region (`role` / `aria-live` stay off
|
|
88
|
+
* the root) while keeping the visuals. For an alert rendered INSIDE
|
|
89
|
+
* a container that already owns the live region — e.g. HkAuthHandoff's
|
|
90
|
+
* failed card, which carries `role="alert"` itself and flips in place
|
|
91
|
+
* on a status change. Nesting a second assertive region there makes a
|
|
92
|
+
* flip announce twice (2026-12-02 review, S2). Default true: the
|
|
93
|
+
* standalone alert keeps its semantics, which every other consumer
|
|
94
|
+
* relies on.
|
|
95
|
+
*
|
|
96
|
+
* The name is `ownsLiveRegion`, NOT `ariaLive`: a camelCase prop
|
|
97
|
+
* lowercases to `arialive`, which CONSUMES the fallthrough
|
|
98
|
+
* `aria-live` attribute — a host's `aria-live="off"` would become an
|
|
99
|
+
* interruption instead of a silence request. */
|
|
100
|
+
ownsLiveRegion: {
|
|
101
|
+
type: BooleanConstructor;
|
|
102
|
+
default: boolean;
|
|
103
|
+
};
|
|
70
104
|
}>> & Readonly<{
|
|
71
105
|
onClose?: (() => any) | undefined;
|
|
72
106
|
}>, {
|
|
@@ -76,5 +110,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
76
110
|
padding: HkPad;
|
|
77
111
|
closable: boolean;
|
|
78
112
|
banner: boolean;
|
|
113
|
+
ownsLiveRegion: boolean;
|
|
79
114
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
80
115
|
export default _default;
|
package/package.json
CHANGED
|
@@ -100,4 +100,21 @@ describe("HkAlert live-region role", () => {
|
|
|
100
100
|
expect(el.querySelector("button.hk-alert-close")).toBeTruthy();
|
|
101
101
|
expect(el.querySelectorAll("[role]").length).toBe(0);
|
|
102
102
|
});
|
|
103
|
+
|
|
104
|
+
it("ownsLiveRegion={false} drops the region entirely, keeping the visuals", () => {
|
|
105
|
+
// For an alert rendered INSIDE a container that already owns the live
|
|
106
|
+
// region (HkAuthHandoff's failed card declares `role="alert"` on its
|
|
107
|
+
// own div and flips in place on a status change): nesting a second
|
|
108
|
+
// assertive region makes that flip announce twice (2026-12-02 review).
|
|
109
|
+
// MUT:alert-ownsliveregion-ignored — hard-coding the variant split back in
|
|
110
|
+
// reddens this: the caller's container must be the ONE region.
|
|
111
|
+
for (const variant of ["error", "warning", "info", "success"] as const) {
|
|
112
|
+
const el = mountAlert({ variant, ownsLiveRegion: false });
|
|
113
|
+
expect(el.getAttribute("role")).toBeNull();
|
|
114
|
+
expect(el.getAttribute("aria-live")).toBeNull();
|
|
115
|
+
// The visual surface is untouched: icon + message still render.
|
|
116
|
+
expect(el.querySelector(".hk-alert-icon")).toBeTruthy();
|
|
117
|
+
expect(el.textContent).toContain("mind the gap");
|
|
118
|
+
}
|
|
119
|
+
});
|
|
103
120
|
});
|
|
@@ -29,6 +29,20 @@ export default defineComponent({
|
|
|
29
29
|
/** Shared container-padding override (see runtime/containerPad) —
|
|
30
30
|
* unset keeps the size's own padding. */
|
|
31
31
|
padding: { type: String as PropType<HkPad>, default: undefined },
|
|
32
|
+
/** Drop this alert's OWN live region (`role` / `aria-live` stay off
|
|
33
|
+
* the root) while keeping the visuals. For an alert rendered INSIDE
|
|
34
|
+
* a container that already owns the live region — e.g. HkAuthHandoff's
|
|
35
|
+
* failed card, which carries `role="alert"` itself and flips in place
|
|
36
|
+
* on a status change. Nesting a second assertive region there makes a
|
|
37
|
+
* flip announce twice (2026-12-02 review, S2). Default true: the
|
|
38
|
+
* standalone alert keeps its semantics, which every other consumer
|
|
39
|
+
* relies on.
|
|
40
|
+
*
|
|
41
|
+
* The name is `ownsLiveRegion`, NOT `ariaLive`: a camelCase prop
|
|
42
|
+
* lowercases to `arialive`, which CONSUMES the fallthrough
|
|
43
|
+
* `aria-live` attribute — a host's `aria-live="off"` would become an
|
|
44
|
+
* interruption instead of a silence request. */
|
|
45
|
+
ownsLiveRegion: { type: Boolean, default: true },
|
|
32
46
|
},
|
|
33
47
|
emits: {
|
|
34
48
|
close: () => true,
|
|
@@ -56,11 +70,15 @@ export default defineComponent({
|
|
|
56
70
|
// in-repo consumers mount the alert conditionally (HkSectionCard
|
|
57
71
|
// error state, HkMfaVerifyCard retry hint). The role rides the
|
|
58
72
|
// ROOT so the whole alert body is one announced region.
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
//
|
|
74
|
+
// `ownsLiveRegion={false}` opts OUT of all of it — the caller's surrounding
|
|
75
|
+
// element is already the one region (HkAuthHandoff's failed card).
|
|
76
|
+
const a11y = computed(() => {
|
|
77
|
+
if (!props.ownsLiveRegion) return { role: undefined, "aria-live": undefined } as const;
|
|
78
|
+
return props.variant === "error" || props.variant === "warning"
|
|
61
79
|
? ({ role: "alert", "aria-live": "assertive" } as const)
|
|
62
|
-
: ({ role: "status", "aria-live": "polite" } as const)
|
|
63
|
-
);
|
|
80
|
+
: ({ role: "status", "aria-live": "polite" } as const);
|
|
81
|
+
});
|
|
64
82
|
|
|
65
83
|
function onClose() {
|
|
66
84
|
isDismissed.value = true;
|
|
@@ -61,7 +61,10 @@ describe("HkAuthHandoff", () => {
|
|
|
61
61
|
}),
|
|
62
62
|
);
|
|
63
63
|
expect(c.querySelector(".hk-auth-handoff-title")?.textContent).toBe("Bind failed");
|
|
64
|
-
|
|
64
|
+
// A failed handoff renders the description through the icon-led alert
|
|
65
|
+
// (the standard error surface), so the description's TEXT rides the
|
|
66
|
+
// alert's message instead of the plain subtitle paragraph.
|
|
67
|
+
expect(c.querySelector(".hk-alert")?.textContent).toContain("Use another account");
|
|
65
68
|
const logo = c.querySelector<HTMLImageElement>(".hk-auth-handoff-logo");
|
|
66
69
|
expect(logo?.getAttribute("src")).toBe("/logo.svg");
|
|
67
70
|
// MUT:handoff-logo-announced (a decorative logo with a non-empty alt
|
|
@@ -105,6 +108,47 @@ describe("HkAuthHandoff", () => {
|
|
|
105
108
|
expect(titled.querySelector(".hk-auth-handoff-state .hk-badge")?.textContent).toContain("Signed in");
|
|
106
109
|
});
|
|
107
110
|
|
|
111
|
+
it("the failed description's alert does NOT own a second live region", () => {
|
|
112
|
+
// The card's own div declares role="alert" (#1682, mutation-pinned);
|
|
113
|
+
// the nested HkAlert must opt out (ownsLiveRegion={false}) or a
|
|
114
|
+
// status flip announces twice.
|
|
115
|
+
const c = mount(
|
|
116
|
+
h(HkAuthHandoff, { status: "failed", description: "Use another account" }),
|
|
117
|
+
);
|
|
118
|
+
expect(c.querySelectorAll("[role='alert']").length).toBe(1);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("a failed handoff's body carries the actions and NO stray text", () => {
|
|
122
|
+
// MUT:handoff-leaked-jsx-comment — a bare `//` comment inside the JSX
|
|
123
|
+
// children rendered VERBATIM on every non-transient handoff screen
|
|
124
|
+
// (ayane's login failure card, 2026-12-02 user screenshot). The body's
|
|
125
|
+
// own text content must be exactly the actions' labels; the
|
|
126
|
+
// button-label lookup table is the only prose the body may carry.
|
|
127
|
+
const c = mount(h(HkAuthHandoff, { status: "failed", onRetry: vi.fn(), onBack: vi.fn() }));
|
|
128
|
+
const body = c.querySelector(".hk-auth-handoff-body");
|
|
129
|
+
expect(body).toBeTruthy();
|
|
130
|
+
// One button, no loose text nodes between them.
|
|
131
|
+
const buttons = body!.querySelectorAll("button");
|
|
132
|
+
expect(buttons.length).toBe(1);
|
|
133
|
+
expect(body!.textContent!.trim()).toBe(buttons[0]!.textContent!.trim());
|
|
134
|
+
expect(body!.textContent).not.toContain("With the default title");
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("a failed handoff's HEADER carries title + description and no leaked prose", () => {
|
|
138
|
+
// The leak was in the header's description block; the body pin above
|
|
139
|
+
// covers the body — this covers the header's own text.
|
|
140
|
+
const c = mount(
|
|
141
|
+
h(HkAuthHandoff, {
|
|
142
|
+
status: "failed",
|
|
143
|
+
title: "Bind failed",
|
|
144
|
+
description: "Use another account",
|
|
145
|
+
}),
|
|
146
|
+
);
|
|
147
|
+
const header = c.querySelector(".hk-auth-handoff-header");
|
|
148
|
+
expect(header).toBeTruthy();
|
|
149
|
+
expect(header!.textContent!.trim()).toBe("Bind failedUse another account");
|
|
150
|
+
});
|
|
151
|
+
|
|
108
152
|
it("default actions: back for failed/expired, none otherwise; each emits", async () => {
|
|
109
153
|
const onRetry = vi.fn();
|
|
110
154
|
const onBack = vi.fn();
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "vue";
|
|
12
12
|
|
|
13
13
|
import { useI18n } from "../i18n/context";
|
|
14
|
+
import HkAlert from "./HkAlert";
|
|
14
15
|
import HkBadge from "./HkBadge";
|
|
15
16
|
import HkButton from "./HkButton";
|
|
16
17
|
import { HkAuthScreen } from "./HkAuthScreen";
|
|
@@ -179,13 +180,21 @@ export const HkAuthHandoff = defineComponent({
|
|
|
179
180
|
) : null}
|
|
180
181
|
<h1 class="s-auth-title hk-auth-handoff-title">{title}</h1>
|
|
181
182
|
{description ? (
|
|
182
|
-
|
|
183
|
+
failed ? (
|
|
184
|
+
// A failed/expired handoff is an ERROR surface: the
|
|
185
|
+
// description rides the family's icon-led alert. The
|
|
186
|
+
// OUTER div already owns the live region
|
|
187
|
+
// (`role="alert"`), so the alert renders VISUALS only
|
|
188
|
+
// — a second assertive region here would announce a
|
|
189
|
+
// status flip twice (2026-12-02 review, S2).
|
|
190
|
+
<HkAlert variant="error" message={description} ownsLiveRegion={false} />
|
|
191
|
+
) : (
|
|
192
|
+
<p class="s-auth-subtitle hk-auth-handoff-description">{description}</p>
|
|
193
|
+
)
|
|
183
194
|
) : null}
|
|
184
195
|
</div>
|
|
185
196
|
<div class="hk-auth-handoff-body">
|
|
186
197
|
{transient ? <HkSpinner center /> : null}
|
|
187
|
-
// With the default title the heading already names the
|
|
188
|
-
// state; the badge repeats it only under a host title.
|
|
189
198
|
{props.status === "success" && props.title ? (
|
|
190
199
|
<div class="hk-auth-handoff-state">
|
|
191
200
|
<HkBadge variant="success" size="md">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="hk-error-landing" content="v1 0.55.
|
|
4
|
+
<meta name="hk-error-landing" content="v1 0.55.527 <dev>">
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
7
|
<meta name="robots" content="noindex" />
|