@celestia-island/hikari 0.55.526 → 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 +10 -0
- package/src/components/HkAuthHandoff.tsx +6 -4
- 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;
|
|
@@ -108,6 +108,16 @@ describe("HkAuthHandoff", () => {
|
|
|
108
108
|
expect(titled.querySelector(".hk-auth-handoff-state .hk-badge")?.textContent).toContain("Signed in");
|
|
109
109
|
});
|
|
110
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
|
+
|
|
111
121
|
it("a failed handoff's body carries the actions and NO stray text", () => {
|
|
112
122
|
// MUT:handoff-leaked-jsx-comment — a bare `//` comment inside the JSX
|
|
113
123
|
// children rendered VERBATIM on every non-transient handoff screen
|
|
@@ -182,10 +182,12 @@ export const HkAuthHandoff = defineComponent({
|
|
|
182
182
|
{description ? (
|
|
183
183
|
failed ? (
|
|
184
184
|
// A failed/expired handoff is an ERROR surface: the
|
|
185
|
-
// description rides the family's icon-led alert
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
|
|
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} />
|
|
189
191
|
) : (
|
|
190
192
|
<p class="s-auth-subtitle hk-auth-handoff-description">{description}</p>
|
|
191
193
|
)
|
|
@@ -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" />
|