{
+ void navigate(${camel}RouteUrl("${routeId}"));
+ }}
+ />
}
guard={ }
/>
diff --git a/src/presentation/adapters/query/application-query.ts b/src/presentation/adapters/query/application-query.ts
index 943488e8..99296c9c 100644
--- a/src/presentation/adapters/query/application-query.ts
+++ b/src/presentation/adapters/query/application-query.ts
@@ -282,6 +282,13 @@ type ApplicationMutationController = Readonly<{
* `state.unknownEffectResendable` carries the same answer to `AsyncSurface`.
*/
canResendUnknownEffect: boolean;
+ /**
+ * 1112/01-01. Whether the oldest request is unknown now, read at the
+ * call, not from the last render: a form asks it when a resend has ended
+ * (`useAppForm` `mutation`). `state.indicator` says the same once the
+ * hook renders again.
+ */
+ holdsUnknownEffect(): boolean;
}>;
type MutationExecution =
@@ -878,6 +885,11 @@ export function useApplicationMutation (
return submit(head.input as Input);
}, [submit, unknownEffectChannel]);
+ const holdsUnknownEffect = useCallback(
+ () => unknownEffectChannel?.admissions[0]?.state === "UNKNOWN",
+ [unknownEffectChannel],
+ );
+
const unknownEffectHead = unknownEffectChannel?.admissions[0];
const canResendUnknownEffect =
unknownEffectChannel !== null &&
@@ -900,6 +912,7 @@ export function useApplicationMutation (
reconcileUnknownEffect,
resendUnknownEffect,
canResendUnknownEffect,
+ holdsUnknownEffect,
});
}
diff --git a/src/presentation/components/async-surface.tsx b/src/presentation/components/async-surface.tsx
index 041d3072..f2773888 100644
--- a/src/presentation/components/async-surface.tsx
+++ b/src/presentation/components/async-surface.tsx
@@ -142,6 +142,12 @@ export type AsyncSurfaceProps = Readonly<{
* terminal error shows its own `failure.requestId`.
*/
supportReference?: string | undefined;
+ /**
+ * 1112/04-02. Words about the unknown save shown with it (a resend the
+ * server refused before the write: `form.resendLater`), not under the input
+ * error summary.
+ */
+ notice?: ReactNode;
}>;
export function AsyncSurface({
@@ -155,6 +161,7 @@ export function AsyncSurface({
onResendUnknownEffect,
headingLevel,
supportReference,
+ notice,
}: AsyncSurfaceProps) {
const { message } = useLocale();
if (state.base === "idle") return idle ?? null;
@@ -231,6 +238,7 @@ export function AsyncSurface({
{message("action.resendMutation")}
) : null}
+ {state.indicator === "mutation-effect-unknown" && notice ? {notice}
: null}
{state.indicator === "mutation-effect-unknown" && supportReference ? (
{message("template.supportReference", {
diff --git a/src/presentation/design-system/index.ts b/src/presentation/design-system/index.ts
index 4ec1456e..535d724f 100644
--- a/src/presentation/design-system/index.ts
+++ b/src/presentation/design-system/index.ts
@@ -123,6 +123,7 @@ export {
FormActions,
FormFailureStatus,
FormField,
+ FormSaveFeedback,
useAppForm,
useDirtyNavigationGuard,
} from "../forms/index.ts";
diff --git a/src/presentation/design-system/primitives/checkbox.tsx b/src/presentation/design-system/primitives/checkbox.tsx
index bfce9843..b132724b 100644
--- a/src/presentation/design-system/primitives/checkbox.tsx
+++ b/src/presentation/design-system/primitives/checkbox.tsx
@@ -42,7 +42,11 @@ export const Checkbox = forwardRef(
}}
type="checkbox"
/>
- {label}
+
+ {label}
+ {/* 1112/05-13. The symbol as Field draws it; the state is on the input. */}
+ {props.required ? * : null}
+
{description ? (
diff --git a/src/presentation/design-system/primitives/dialog.tsx b/src/presentation/design-system/primitives/dialog.tsx
index fcb0ea3b..8e1563d2 100644
--- a/src/presentation/design-system/primitives/dialog.tsx
+++ b/src/presentation/design-system/primitives/dialog.tsx
@@ -41,6 +41,7 @@ export const Dialog = forwardRef(
const dialogRef = useRef(null);
const previousFocusRef = useRef(null);
const focusRestoreGenerationRef = useRef(0);
+ const innerEscapeRef = useRef(false);
const titleId = useId();
const descriptionId = useId();
useImperativeHandle(forwardedRef, () => dialogRef.current!, []);
@@ -103,16 +104,26 @@ export const Dialog = forwardRef(
className={`ui-dialog ${className}`.trim()}
onCancel={(event) => {
event.preventDefault();
+ // The Escape that fired this cancel closed an inner layer.
+ if (innerEscapeRef.current) return;
onClose();
}}
onClick={(event) => {
if (event.target === event.currentTarget) onClose();
}}
onKeyDown={(event) => {
- if (event.key === "Escape") {
- event.preventDefault();
- onClose();
+ if (event.key !== "Escape") return;
+ // 1112/05-11. A Menu, Popover or Tooltip inside handled this Escape
+ // (it prevented the default): it closes that layer, not the Dialog.
+ if (event.defaultPrevented) {
+ innerEscapeRef.current = true;
+ globalThis.setTimeout(() => {
+ innerEscapeRef.current = false;
+ }, 0);
+ return;
}
+ event.preventDefault();
+ onClose();
}}
ref={dialogRef}
>
diff --git a/src/presentation/design-system/primitives/escape-layer.ts b/src/presentation/design-system/primitives/escape-layer.ts
new file mode 100644
index 00000000..ada44548
--- /dev/null
+++ b/src/presentation/design-system/primitives/escape-layer.ts
@@ -0,0 +1,15 @@
+/**
+ * 1112/05-11. Whether an Escape is for a layer drawn over the page (a
+ * Popover or a shown Tooltip) whose root is `root`. Not when it was pressed
+ * inside a dialog that does not hold the layer: that Escape is the dialog's.
+ * An Escape from the layer, from a dialog around it, or from no element
+ * (focus on the body, as after a click in WebKit) is the layer's.
+ */
+export function escapeIsForLayer(event: KeyboardEvent, root: Element | null): boolean {
+ const target = event.target;
+ if (root === null || !(target instanceof Element) || root.contains(target)) {
+ return true;
+ }
+ const dialog = target.closest("dialog");
+ return dialog === null || dialog.contains(root);
+}
diff --git a/src/presentation/design-system/primitives/popover.tsx b/src/presentation/design-system/primitives/popover.tsx
index 98e1438d..6b9e8490 100644
--- a/src/presentation/design-system/primitives/popover.tsx
+++ b/src/presentation/design-system/primitives/popover.tsx
@@ -1,6 +1,7 @@
import { useEffect, useId, useRef, useState } from "react";
import { Button } from "./button.tsx";
+import { escapeIsForLayer } from "./escape-layer.ts";
export type PopoverProps = Readonly<{
triggerLabel: string;
@@ -12,6 +13,7 @@ export function Popover({ triggerLabel, children }: PopoverProps) {
const rootRef = useRef(null);
const triggerRef = useRef(null);
const contentId = useId();
+ const triggerId = useId();
useEffect(() => {
if (!open) return;
@@ -24,17 +26,25 @@ export function Popover({ triggerLabel, children }: PopoverProps) {
triggerRef.current?.focus();
}
}
+ // Capture phase, and the default prevented: the Escape closes this
+ // layer only, not a Dialog around it (1112/05-11). An Escape pressed in
+ // a Dialog this popover is not in is the Dialog's.
function closeOnEscape(event: KeyboardEvent) {
- if (event.key === "Escape") {
+ if (
+ event.key === "Escape" &&
+ !event.defaultPrevented &&
+ escapeIsForLayer(event, rootRef.current)
+ ) {
+ event.preventDefault();
setOpen(false);
triggerRef.current?.focus();
}
}
document.addEventListener("pointerdown", closeOutside);
- document.addEventListener("keydown", closeOnEscape);
+ document.addEventListener("keydown", closeOnEscape, true);
return () => {
document.removeEventListener("pointerdown", closeOutside);
- document.removeEventListener("keydown", closeOnEscape);
+ document.removeEventListener("keydown", closeOnEscape, true);
};
}, [open]);
@@ -43,6 +53,7 @@ export function Popover({ triggerLabel, children }: PopoverProps) {
setOpen((current) => !current)}
ref={triggerRef}
variant="secondary"
@@ -50,7 +61,12 @@ export function Popover({ triggerLabel, children }: PopoverProps) {
{triggerLabel}
{open ? (
-
+
{children}
) : null}
diff --git a/src/presentation/design-system/primitives/search-field.tsx b/src/presentation/design-system/primitives/search-field.tsx
index ae02e664..2ea9d64a 100644
--- a/src/presentation/design-system/primitives/search-field.tsx
+++ b/src/presentation/design-system/primitives/search-field.tsx
@@ -47,6 +47,9 @@ export const SearchField = forwardRef
(
className="ui-field__input"
id={controlId}
ref={inputRef}
+ // 1112/05-13. Required both ways, as TextField: the symbol
+ // Field draws and the state on the input.
+ required={required}
type="search"
value={value}
/>
diff --git a/src/presentation/design-system/primitives/text-area.tsx b/src/presentation/design-system/primitives/text-area.tsx
index 8c95cf97..99e4beac 100644
--- a/src/presentation/design-system/primitives/text-area.tsx
+++ b/src/presentation/design-system/primitives/text-area.tsx
@@ -45,33 +45,52 @@ export const TextArea = forwardRef(
label={label}
required={required}
>
- {({ controlId, describedBy, invalid }) => (
- <>
-
dismiss(toast.id)}
+ onClick={(event) => {
+ // The button goes away with its toast. Focus moves to the next
+ // toast's close button, or back to where it came from.
+ const item = event.currentTarget.closest("article");
+ const items = item?.parentElement
+ ? [...item.parentElement.querySelectorAll(":scope > article")]
+ : [];
+ const index = item ? items.indexOf(item) : -1;
+ const neighbour = items[index + 1] ?? items[index - 1];
+ const next =
+ neighbour?.querySelector("button") ??
+ (returnFocus()?.isConnected ? returnFocus() : null);
+ dismiss(toast.id);
+ next?.focus();
+ }}
variant="ghost"
>
diff --git a/src/presentation/design-system/primitives/tooltip.tsx b/src/presentation/design-system/primitives/tooltip.tsx
index 151799cb..5ac9869a 100644
--- a/src/presentation/design-system/primitives/tooltip.tsx
+++ b/src/presentation/design-system/primitives/tooltip.tsx
@@ -1,4 +1,6 @@
-import { cloneElement, useEffect, useId, useState } from "react";
+import { cloneElement, useEffect, useId, useRef, useState } from "react";
+
+import { escapeIsForLayer } from "./escape-layer.ts";
export type TooltipProps = Readonly<{
content: string;
@@ -7,29 +9,55 @@ export type TooltipProps = Readonly<{
/**
* Describes its focusable child (WCAG 1.4.13): the child carries
- * `aria-describedby`, and Escape hides the tooltip until the next hover or
- * focus.
+ * `aria-describedby`, Escape hides the tooltip until the next hover or
+ * focus, and the pointer can move onto the tooltip (primitives.css).
*/
export function Tooltip({ content, children }: TooltipProps) {
const tooltipId = useId();
const [dismissed, setDismissed] = useState(false);
+ const [hovered, setHovered] = useState(false);
+ const [focused, setFocused] = useState(false);
+ const rootRef = useRef(null);
+ const shown = (hovered || focused) && !dismissed;
useEffect(() => {
- if (dismissed) return;
- // Document level: a hovered trigger does not have keyboard focus.
+ if (!shown) return;
+ // Document level: a hovered trigger does not have keyboard focus. Capture
+ // phase, and the default prevented: this Escape hides the tooltip only,
+ // not a Dialog around it (1112/05-11). A tooltip that is not shown, or
+ // one outside the Dialog the Escape was pressed in, leaves it alone.
function dismissOnEscape(event: KeyboardEvent) {
- if (event.key === "Escape") setDismissed(true);
+ if (
+ event.key !== "Escape" ||
+ event.defaultPrevented ||
+ !escapeIsForLayer(event, rootRef.current)
+ ) {
+ return;
+ }
+ event.preventDefault();
+ setDismissed(true);
}
- document.addEventListener("keydown", dismissOnEscape);
- return () => document.removeEventListener("keydown", dismissOnEscape);
- }, [dismissed]);
+ document.addEventListener("keydown", dismissOnEscape, true);
+ return () => document.removeEventListener("keydown", dismissOnEscape, true);
+ }, [shown]);
const describedBy = [children.props["aria-describedby"], tooltipId]
.filter(Boolean)
.join(" ");
return (
setDismissed(false)}
- onMouseEnter={() => setDismissed(false)}
+ ref={rootRef}
+ onBlur={(event) => {
+ if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
+ }}
+ onFocus={() => {
+ setFocused(true);
+ setDismissed(false);
+ }}
+ onMouseEnter={() => {
+ setHovered(true);
+ setDismissed(false);
+ }}
+ onMouseLeave={() => setHovered(false)}
>
{cloneElement(children, { "aria-describedby": describedBy })}
);
}
+
+/** What FormSaveFeedback reads of a `useAppForm` result given the `mutation` option. */
+export type FormSaveFeedbackForm = Readonly<{
+ effectUnknown: boolean;
+ otherSaveRunning: boolean;
+ mutationState: AsyncState | undefined;
+ failure: AppFailure | null;
+ result: FormResultState;
+ notice: ParameterlessMessageKey | null;
+ supportReference: string | undefined;
+ submitForm(): Promise;
+ confirmUnknownEffect(then?: () => void): Promise;
+ resendUnknownEffect(): Promise | null>;
+}>;
+
+/**
+ * 1112/01-01. The feedback of a form that saves through a mutation
+ * (`useAppForm` with `mutation`), in the order a page used to write out by
+ * hand: signing in again (D-2, whatever the effect), the unknown result
+ * (confirm it was applied, or resend it with the same key), then another
+ * save failure that is not an input error, then a conflict, then a save of
+ * the mutation this form did not start. Put it in the page template's
+ * feedback area (`FormPage` `feedback`, `feedbackId`). What a resend saved
+ * goes to the form's `onSaved`.
+ */
+export function FormSaveFeedback(props: Readonly<{
+ form: FormSaveFeedbackForm;
+ /**
+ * After "it was applied" has settled the request, while the form is
+ * mounted (a page opens the list).
+ */
+ onConfirmed?: () => void;
+ /** The action of a failure that is not "try again" (sign in, for example). */
+ onFailureAction?: () => void;
+}>) {
+ const { message } = useLocale();
+ const { form, onConfirmed, onFailureAction } = props;
+ const notice = form.notice ? message(form.notice) : undefined;
+ const failureStatus = form.failure ? (
+ void form.submitForm() : onFailureAction}
+ />
+ ) : null;
+ if (form.failure?.action === "reauth") return failureStatus;
+ if (form.effectUnknown && form.mutationState) {
+ return (
+ {
+ void form.confirmUnknownEffect(onConfirmed);
+ }}
+ onResendUnknownEffect={() => {
+ void form.resendUnknownEffect();
+ }}
+ state={form.mutationState}
+ supportReference={form.supportReference}
+ />
+ );
+ }
+ if (failureStatus) return failureStatus;
+ if (form.result === "conflict" && notice) {
+ return {notice}
;
+ }
+ if (form.otherSaveRunning && form.mutationState && form.result !== "effect-unknown") {
+ return ;
+ }
+ return null;
+}
diff --git a/src/presentation/forms/use-app-form.ts b/src/presentation/forms/use-app-form.ts
index 47abaea5..e4aff105 100644
--- a/src/presentation/forms/use-app-form.ts
+++ b/src/presentation/forms/use-app-form.ts
@@ -9,6 +9,7 @@ import {
type FormEvent,
} from "react";
import { flushSync } from "react-dom";
+import type { AsyncState } from "../../application/view-models/async-state.ts";
import type { ZodIssue, ZodType } from "../../contracts/zod.ts";
import {
isRefusedOnEveryAttempt,
@@ -39,6 +40,21 @@ export type FormRefusalMessage = Readonly<{
field?: FieldName;
}>;
+/**
+ * 1112/01-01. What `useAppForm` needs of the mutation it saves through
+ * (`useApplicationMutation`). A `BoundMutation` is one.
+ */
+export type FormSaveMutation = Readonly<{
+ state: AsyncState;
+ reconcileUnknownEffect(resolution: "APPLIED"): Promise;
+ resendUnknownEffect(): Promise | null>;
+ /**
+ * Whether the mutation holds an unknown result now. The form reads it
+ * when a resend has ended instead of judging the outcome itself.
+ */
+ holdsUnknownEffect(): boolean;
+}>;
+
type AppFormOptions<
Values extends FormValues,
Command,
@@ -60,6 +76,24 @@ type AppFormOptions<
* unknown whatever its code.
*/
refusalMessages?: Readonly>>;
+ /**
+ * 1112/01-01. The mutation `submit` goes through. Given, the form owns the
+ * rules a page used to copy: it refuses a save while the mutation holds an
+ * unknown result or runs one this form did not start (`saveBlocked`), the
+ * unknown result's confirm and resend go through it
+ * (`confirmUnknownEffect`, `resendUnknownEffect`), and what it says about
+ * a save that is not an input error goes to `notice` for
+ * `FormSaveFeedback`, not to the input error summary.
+ */
+ mutation?: FormSaveMutation;
+ /**
+ * 1106/08-02, 1112/01-01. A save this form shows ended with a value (a
+ * submit or a resend): a page opens what was saved here. Called while the
+ * form is mounted only, after the form shows the outcome and is no longer
+ * pending, so a leave guard reads the values left on screen (values a
+ * remounted form never sent stay guarded).
+ */
+ onSaved?(value: Output): void;
}>;
export function useAppForm<
@@ -76,6 +110,8 @@ export function useAppForm<
submit,
resetOnSuccess = true,
refusalMessages,
+ mutation,
+ onSaved,
} = options;
const generatedId = useId().replaceAll(":", "");
const formId = `app-form-${generatedId}`;
@@ -108,15 +144,37 @@ export function useAppForm<
[formErrorKeys, resolve],
);
const [pending, setPending] = useState(false);
+ // 1112/04-02. With a mutation: the status line FormSaveFeedback shows.
+ const [notice, setNotice] = useState(null);
+ const indicator = mutation?.state.indicator;
+ const effectUnknown = indicator === "mutation-effect-unknown";
+ // A save of this mutation the form did not start: one left running when
+ // the user came back, or the check behind "confirm applied" (1105/08-04).
+ const otherSaveRunning = indicator === "mutation-pending" && !pending;
+ const saveBlocked = effectUnknown || indicator === "mutation-pending";
+ const saveBlockedRef = useRef(saveBlocked);
+ saveBlockedRef.current = saveBlocked;
const [result, setResult] = useState("idle");
const [statusFailure, setStatusFailure] = useState(null);
const pendingRef = useRef | null> | null>(null);
- const unknownSubmissionRef = useRef(null);
+ // The save whose effect is unknown: what it sent, or `values: null` when
+ // an earlier mount sent it (a resend from a remounted form). Held, it keeps
+ // a new save from going out as a new request.
+ const unknownSubmissionRef = useRef | null>(null);
// 1103/08-02. A save that ends in neither a field error nor success shows
// its status above the form while the page disables the button that had
// focus, so the browser drops focus to the body. The status takes focus
// once it has rendered (`feedbackId`).
const focusFeedbackRef = useRef(false);
+ // 1106/08-02. A save outlives the form when the user leaves while it runs.
+ // Ending then, it opens nothing and changes no state.
+ const mountedRef = useRef(false);
+ useEffect(() => {
+ mountedRef.current = true;
+ return () => {
+ mountedRef.current = false;
+ };
+ }, []);
// 1105/08-01. The recovery actions (confirm applied, resend, retry) sit in
// that status and go away with it once they have done their work, so the
// browser drops focus to the body again. A success that replaces a status
@@ -173,6 +231,8 @@ export function useAppForm<
return next;
});
setFormErrors([]);
+ // The notice of a save still unknown stays; a conflict's goes with it.
+ setNotice((current) => (unknownSubmissionRef.current ? current : null));
setResult((current) =>
unknownSubmissionRef.current ? current : "idle",
);
@@ -205,6 +265,7 @@ export function useAppForm<
setTouched(new Set());
setFieldErrors({} as FieldErrors);
setFormErrors([]);
+ setNotice(null);
setResult("idle");
},
[defaultValues],
@@ -218,6 +279,7 @@ export function useAppForm<
flushSync(() => {
setFieldErrors({} as FieldErrors);
setFormErrors([]);
+ setNotice(null);
setResult("success");
if (resetOnSuccess) {
setValues(defaultValues);
@@ -231,35 +293,54 @@ export function useAppForm<
[defaultValues, resetOnSuccess],
);
+ /**
+ * The save went through, with values this form did not send: an earlier
+ * mount sent them. 1106/08-01. The confirmed save is shown, and focus,
+ * lost with the button that confirmed it, goes to the feedback area that
+ * shows it. The values on screen were never sent, so they and the dirty
+ * state stay as they are (diff review of 1106/08-01).
+ */
+ const settleUnsentValues = useCallback(() => {
+ unknownSubmissionRef.current = null;
+ focusFeedbackRef.current = focusIsLost();
+ setFieldErrors({} as FieldErrors);
+ setFormErrors([]);
+ setNotice(null);
+ setResult("success");
+ }, []);
+
const settleApplied = useCallback(() => {
- const submittedValues = unknownSubmissionRef.current;
- if (!submittedValues) {
- // 1106/08-01. After a remount the form no longer holds the submitted
- // values. The confirmed save is shown, and focus, lost with the
- // confirm button, goes to the feedback area that shows it. The values
- // on screen were never sent, so they and the dirty state stay as they
- // are (diff review of 1106/08-01).
- focusFeedbackRef.current = focusIsLost();
- setFieldErrors({} as FieldErrors);
- setFormErrors([]);
- setResult("success");
+ const submittedValues = unknownSubmissionRef.current?.values ?? null;
+ if (submittedValues === null) {
+ // After a remount the form no longer holds the submitted values.
+ settleUnsentValues();
return;
}
settleSuccessfulValues(submittedValues);
- }, [settleSuccessfulValues]);
+ }, [settleSuccessfulValues, settleUnsentValues]);
const settleNotApplied = useCallback(() => {
if (!unknownSubmissionRef.current) return;
unknownSubmissionRef.current = null;
setFieldErrors({} as FieldErrors);
setFormErrors([]);
+ setNotice(null);
setResult("idle");
}, []);
+ /**
+ * `submittedValues` is null when this form did not send the request the
+ * outcome answers (a resend after a remount): a success then keeps the
+ * values on screen, and a result left unknown holds no values either.
+ */
const applyOutcome = useCallback(
- (outcome: FormResult, submittedValues: Values) => {
+ (outcome: FormResult, submittedValues: Values | null) => {
+ const settleSaved = () =>
+ submittedValues === null
+ ? settleUnsentValues()
+ : settleSuccessfulValues(submittedValues);
if (outcome.ok) {
- settleSuccessfulValues(submittedValues);
+ settleSaved();
return;
}
const refusal = refusalFor(refusalMessages, outcome.error);
@@ -283,7 +364,20 @@ export function useAppForm<
if (onField !== undefined) focusField(onField);
return;
}
- if (outcome.error.kind === "VALIDATION_REJECTED") {
+ if (
+ outcome.error.effect === "MAYBE_APPLIED" &&
+ outcome.error.action !== "reauth"
+ ) {
+ // 1101/03-04. Before an input error: a save that may have applied is
+ // not corrected and sent again, whatever field its failure names.
+ focusFeedbackRef.current = true;
+ unknownSubmissionRef.current = { values: submittedValues };
+ setFieldErrors({} as FieldErrors);
+ setFormErrors([]);
+ // 0929/08-04. Kept for its request id, not shown as a status.
+ setStatusFailure(outcome.error);
+ setResult("effect-unknown");
+ } else if (outcome.error.kind === "VALIDATION_REJECTED") {
unknownSubmissionRef.current = null;
const mapped = mapValidationFailureToFields(
outcome.error,
@@ -301,19 +395,19 @@ export function useAppForm<
setFormErrors([]);
setStatusFailure(outcome.error);
setResult("reauth-required");
- } else if (outcome.error.effect === "MAYBE_APPLIED") {
- focusFeedbackRef.current = true;
- unknownSubmissionRef.current = submittedValues;
- setFormErrors([]);
- // 0929/08-04. Kept for its request id, not shown as a status.
- setStatusFailure(outcome.error);
- setResult("effect-unknown");
} else if (outcome.error.effect === "APPLIED_CONFIRMED") {
- settleSuccessfulValues(submittedValues);
+ settleSaved();
} else if (outcome.error.kind === "CONFLICT") {
focusFeedbackRef.current = true;
unknownSubmissionRef.current = null;
- setFormErrors(["form.conflict"]);
+ // 1112/04-02. Not an input error: with a mutation, FormSaveFeedback
+ // says it; without one the page reads it from formErrors as before.
+ if (mutation) {
+ setFormErrors([]);
+ setNotice("form.conflict");
+ } else {
+ setFormErrors(["form.conflict"]);
+ }
setResult("conflict");
} else if (
outcome.error.kind === "FORBIDDEN" ||
@@ -339,15 +433,32 @@ export function useAppForm<
allowedServerFields,
focusField,
focusFirstError,
+ mutation,
refusalMessages,
settleSuccessfulValues,
+ settleUnsentValues,
],
);
+ /**
+ * The end of a save the form shows: no longer pending, committed before
+ * `onSaved` runs, so a page that navigates there meets the form's own leave
+ * guard. Nothing runs once the form is gone.
+ */
+ const finishSave = useCallback(
+ (outcome: FormResult | null) => {
+ if (!mountedRef.current) return;
+ flushSync(() => setPending(false));
+ if (outcome?.ok) onSaved?.(outcome.value);
+ },
+ [onSaved],
+ );
+
const validateAndSubmit = useCallback(
async (): Promise | null> => {
setFieldErrors({} as FieldErrors);
setFormErrors([]);
+ setNotice(null);
const parsed = await schema.safeParseAsync(values);
if (!parsed.success) {
@@ -372,17 +483,19 @@ export function useAppForm<
const command = mapToCommand(parsed.data);
setPending(true);
+ let outcome: FormResult | null = null;
try {
- const outcome = await submit(command);
+ outcome = await submit(command);
applyOutcome(outcome, parsed.data);
return outcome;
} finally {
- setPending(false);
+ finishSave(outcome);
}
},
[
allowedServerFields,
applyOutcome,
+ finishSave,
focusFirstError,
mapToCommand,
schema,
@@ -398,6 +511,9 @@ export function useAppForm<
// let a second submit through before the command starts.
if (pendingRef.current) return pendingRef.current;
if (unknownSubmissionRef.current) return Promise.resolve(null);
+ // 1112/01-01. The mutation holds an unknown result or runs a save this
+ // form did not start: a new save would go out as a second request.
+ if (saveBlockedRef.current) return Promise.resolve(null);
const submission = validateAndSubmit().finally(() => {
pendingRef.current = null;
});
@@ -421,24 +537,34 @@ export function useAppForm<
send: () => Promise | null>,
): Promise | null> => {
if (pendingRef.current) return pendingRef.current;
- // After a remount the form no longer holds the submitted values.
- const submittedValues = unknownSubmissionRef.current ?? values;
+ // After a remount the form no longer holds the submitted values, and
+ // the values on screen were never sent (1106/03-01 diff review FR-03).
+ const submittedValues = unknownSubmissionRef.current?.values ?? null;
const resend = (async () => {
setPending(true);
+ let outcome: FormResult | null = null;
try {
- const outcome = await send();
- if (outcome && resendLeftUnknown(outcome)) {
+ outcome = await send();
+ if (outcome && resendLeftUnknown(outcome, mutation)) {
focusFeedbackRef.current = true;
- unknownSubmissionRef.current = submittedValues;
+ unknownSubmissionRef.current = { values: submittedValues };
setFieldErrors({} as FieldErrors);
- setFormErrors(["form.resendLater"]);
+ // 1112/04-02. With a mutation the words go to the unknown
+ // result's own surface (FormSaveFeedback), not under the input
+ // error summary.
+ if (mutation) {
+ setFormErrors([]);
+ setNotice("form.resendLater");
+ } else {
+ setFormErrors(["form.resendLater"]);
+ }
setResult("effect-unknown");
} else if (outcome) {
applyOutcome(outcome, submittedValues);
}
return outcome;
} finally {
- setPending(false);
+ finishSave(outcome);
}
})().finally(() => {
pendingRef.current = null;
@@ -446,9 +572,40 @@ export function useAppForm<
pendingRef.current = resend;
return resend;
},
- [applyOutcome, values],
+ [applyOutcome, finishSave, mutation],
);
+ /**
+ * 1112/01-01. The unknown result's "it was applied": the mutation settles
+ * its request, then the form shows the save (`settleApplied`), then `then`
+ * runs while the form is mounted (1105/08-02: a page opens the list, which
+ * shows whether the item is there). Without a mutation it rejects.
+ */
+ const confirmUnknownEffect = useCallback(
+ async (then?: () => void): Promise => {
+ if (!mutation) throw new TypeError("useAppForm: confirmUnknownEffect needs the mutation option");
+ await mutation.reconcileUnknownEffect("APPLIED");
+ if (!mountedRef.current) return;
+ settleApplied();
+ then?.();
+ },
+ [mutation, settleApplied],
+ );
+
+ /**
+ * 1112/01-01. The unknown result's "send the same request again":
+ * `resendUnknown` with the mutation's own resend. What it saved goes to
+ * `onSaved` like a submit's.
+ */
+ const resendUnknownEffect = useCallback((): Promise | null> => {
+ if (!mutation) {
+ return Promise.reject(
+ new TypeError("useAppForm: resendUnknownEffect needs the mutation option"),
+ );
+ }
+ return resendUnknown(() => mutation.resendUnknownEffect());
+ }, [mutation, resendUnknown]);
+
return Object.freeze({
formId,
/**
@@ -488,6 +645,21 @@ export function useAppForm<
reset,
settleApplied,
settleNotApplied,
+ /**
+ * 1112/01-01. With the `mutation` option: the mutation holds an unknown
+ * result or runs a save; `submitForm` sends nothing. Without it, false.
+ */
+ saveBlocked,
+ /** The mutation's request is unknown: FormSaveFeedback shows its surface. */
+ effectUnknown,
+ /** A save of the mutation this form did not start is running. */
+ otherSaveRunning,
+ /** The mutation's state, for FormSaveFeedback's surfaces. */
+ mutationState: mutation?.state,
+ /** 1112/04-02. What the save feedback says besides a failure (a key). */
+ notice,
+ confirmUnknownEffect,
+ resendUnknownEffect,
});
}
@@ -512,21 +684,27 @@ function refusalFor(
}
/**
- * 1106/03-01. The resend did not reach the write: the request it repeats is
- * still unknown, and the mutation coordinator keeps its key. Signing in again
- * still comes first (D-2). A refusal every attempt gets
- * (`isRefusedOnEveryAttempt`, the coordinator's own test) settles the request
- * instead, and the form shows it as for a first save (field errors, a save
- * it takes again).
+ * 1106/03-01. The resend did not reach the write (`NOT_APPLIED`,
+ * `NOT_STARTED`) and the request it repeats is still unknown, its key kept.
+ * Signing in again still comes first (D-2). Otherwise the form shows the
+ * outcome as for a first save (field errors, a save it takes again).
+ * 1112/01-01. Whether the request is still unknown is the mutation's own
+ * answer, read now. A form given no mutation (a page generated before it)
+ * cannot ask: it reads the refusals every attempt gets
+ * (`isRefusedOnEveryAttempt`), the same rule the mutation applies.
*/
-function resendLeftUnknown(outcome: FormResult): boolean {
- return (
- !outcome.ok &&
- (outcome.error.effect === "NOT_APPLIED" ||
- outcome.error.effect === "NOT_STARTED") &&
- outcome.error.action !== "reauth" &&
- !isRefusedOnEveryAttempt(outcome.error)
- );
+function resendLeftUnknown(
+ outcome: FormResult,
+ mutation: FormSaveMutation | undefined,
+): boolean {
+ if (outcome.ok) return false;
+ const { effect, action } = outcome.error;
+ if ((effect !== "NOT_APPLIED" && effect !== "NOT_STARTED") || action === "reauth") {
+ return false;
+ }
+ return mutation
+ ? mutation.holdsUnknownEffect()
+ : !isRefusedOnEveryAttempt(outcome.error);
}
/** 1105/08-01. Nothing has focus: the focused element left the document. */
diff --git a/src/presentation/pages/home-page.tsx b/src/presentation/pages/home-page.tsx
index bdfda7e8..bb626a13 100644
--- a/src/presentation/pages/home-page.tsx
+++ b/src/presentation/pages/home-page.tsx
@@ -53,7 +53,7 @@ export default function HomePage() {
title={message("route.APP_HOME.title")}
description={message("home.description")}
/>
-
+
{READINESS_ITEMS.map((item) => (
{message(`home.readiness.${item}.title`)}
diff --git a/src/presentation/styles/theme/primitives.css b/src/presentation/styles/theme/primitives.css
index fd6c9434..191b9512 100644
--- a/src/presentation/styles/theme/primitives.css
+++ b/src/presentation/styles/theme/primitives.css
@@ -516,9 +516,21 @@
transition: opacity var(--duration-fast) var(--easing-standard);
}
+ /* 1112/05-06. WCAG 1.4.13 hoverable: a shown tooltip takes the pointer,
+ and the bridge below it covers the gap to the trigger, so moving onto it
+ keeps .ui-tooltip hovered. A hidden one stays out of the pointer's way. */
+ .ui-tooltip__content::before {
+ position: absolute;
+ inset-inline: 0;
+ inset-block-start: 100%;
+ block-size: var(--space-2);
+ content: "";
+ }
+
.ui-tooltip:focus-within .ui-tooltip__content,
.ui-tooltip:hover .ui-tooltip__content {
opacity: 1;
+ pointer-events: auto;
}
.ui-progress,
diff --git a/src/presentation/styles/theme/templates.css b/src/presentation/styles/theme/templates.css
index a8cc1da2..7623f816 100644
--- a/src/presentation/styles/theme/templates.css
+++ b/src/presentation/styles/theme/templates.css
@@ -4,7 +4,9 @@
padding-block: clamp(1rem, 5vw, 3.5rem) 0.5rem;
}
- [data-route-heading]:focus {
+ /* 1112/05-02. Pointer navigation only: a keyboard user keeps the
+ :focus-visible ring (base.css) on the heading each route move focuses. */
+ [data-route-heading]:focus:not(:focus-visible) {
outline: none;
}
@@ -30,6 +32,12 @@
min-width: 0;
}
+ /* A form page always holds its save feedback (FormSaveFeedback); with
+ nothing to say it takes no row, so it adds no gap. */
+ .page-template__feedback:empty {
+ display: none;
+ }
+
.page-template__breadcrumb {
padding-block-start: 1rem;
color: var(--color-content-muted);
diff --git a/tests/component/design-system-a11y.test.tsx b/tests/component/design-system-a11y.test.tsx
new file mode 100644
index 00000000..b43911cb
--- /dev/null
+++ b/tests/component/design-system-a11y.test.tsx
@@ -0,0 +1,270 @@
+// @vitest-environment jsdom
+
+import { render, screen, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { useState } from "react";
+import { describe, expect, it, vi } from "vitest";
+
+import {
+ Button,
+ Checkbox,
+ Dialog,
+ Menu,
+ Popover,
+ SearchField,
+ TextArea,
+ ToastProvider,
+ Tooltip,
+ useToast,
+} from "../../src/presentation/design-system/index.ts";
+
+/**
+ * 1112/05-10, 05-11, 05-13, 05-14, 05-17. What the shared primitives promise
+ * a keyboard and screen reader user (docs/design/2026-07-26-design-system-platform-design.md
+ * 8.1·8.2절, WCAG 2.2 AA): a named dialog, Escape that closes the innermost
+ * layer only, required shown both ways, focus that does not fall to the body,
+ * and a counter that is not announced on every key.
+ */
+
+function DialogWith({ onClose, children }: Readonly<{ onClose(): void; children: React.ReactNode }>) {
+ return (
+
+ {children}
+
+ );
+}
+
+describe("Popover", () => {
+ it("names its dialog after the trigger", async () => {
+ const user = userEvent.setup();
+ render(
+
+ 내부 작업
+ ,
+ );
+
+ await user.click(screen.getByRole("button", { name: "설명 열기" }));
+
+ expect(screen.getByRole("dialog", { name: "설명 열기" })).toBeVisible();
+ });
+});
+
+describe("Escape inside a Dialog", () => {
+ it("closes an open Popover and keeps the Dialog", async () => {
+ const user = userEvent.setup();
+ const onClose = vi.fn();
+ render(
+
+
+ 내부 작업
+
+ ,
+ );
+ await user.click(screen.getByRole("button", { name: "설명 열기" }));
+ await user.click(screen.getByRole("button", { name: "내부 작업" }));
+
+ await user.keyboard("{Escape}");
+
+ expect(screen.queryByRole("button", { name: "내부 작업" })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "설명 열기" })).toHaveFocus();
+ expect(onClose).not.toHaveBeenCalled();
+ });
+
+ it("closes an open Menu and keeps the Dialog", async () => {
+ const user = userEvent.setup();
+ const onClose = vi.fn();
+ render(
+
+ {} }]} />
+ ,
+ );
+ await user.click(screen.getByRole("button", { name: "더 보기" }));
+ expect(screen.getByRole("menu")).toBeVisible();
+
+ await user.keyboard("{Escape}");
+
+ expect(screen.queryByRole("menu")).not.toBeInTheDocument();
+ expect(onClose).not.toHaveBeenCalled();
+ });
+
+ it("hides a shown Tooltip and keeps the Dialog", async () => {
+ const user = userEvent.setup();
+ const onClose = vi.fn();
+ render(
+
+
+ 도움말
+
+ ,
+ );
+ await user.hover(screen.getByRole("button", { name: "도움말" }));
+
+ await user.keyboard("{Escape}");
+
+ expect(screen.getByRole("tooltip", { hidden: true })).not.toBeVisible();
+ expect(onClose).not.toHaveBeenCalled();
+ });
+
+ // round9 confirm review. A popover or tooltip left open outside a Dialog
+ // does not take the Dialog's Escape: the Escape belongs to the Dialog it
+ // was pressed in.
+ it.each([
+ [
+ "a Popover",
+ (
+
+ 내부 작업
+
+ ),
+ (user: ReturnType) => user.click(screen.getByRole("button", { name: "설명 열기" })),
+ ],
+ [
+ "a Tooltip",
+ (
+
+ 도움말
+
+ ),
+ (user: ReturnType) => user.hover(screen.getByRole("button", { name: "도움말" })),
+ ],
+ ])("closes the Dialog when %s outside it is open", async (_label, layer, openLayer) => {
+ const user = userEvent.setup();
+ const onClose = vi.fn();
+ render(
+ <>
+ {layer}
+
+ 안쪽 버튼
+
+ >,
+ );
+ await openLayer(user);
+ screen.getByRole("button", { name: "안쪽 버튼" }).focus();
+
+ await user.keyboard("{Escape}");
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
+
+ // WebKit does not focus a clicked button: an Escape with focus on the body
+ // still closes the open Popover.
+ it("closes an open Popover on an Escape from the body", async () => {
+ const user = userEvent.setup();
+ render(
+
+ 내부 작업
+ ,
+ );
+ await user.click(screen.getByRole("button", { name: "설명 열기" }));
+ (document.activeElement as HTMLElement | null)?.blur();
+
+ await user.keyboard("{Escape}");
+
+ expect(screen.queryByRole("button", { name: "내부 작업" })).not.toBeInTheDocument();
+ });
+
+ it("closes the Dialog when no inner layer is open", async () => {
+ const user = userEvent.setup();
+ const onClose = vi.fn();
+ render(
+
+ 안쪽 버튼
+ ,
+ );
+ screen.getByRole("button", { name: "안쪽 버튼" }).focus();
+
+ await user.keyboard("{Escape}");
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
+});
+
+describe("required fields", () => {
+ it("marks a required SearchField both on the input and with the symbol", () => {
+ render( {}} clearLabel="지우기" onClear={() => {}} />);
+
+ expect(screen.getByRole("searchbox", { name: /검색/u })).toBeRequired();
+ expect(screen.getByText("*", { exact: false })).toHaveAttribute("aria-hidden", "true");
+ });
+
+ it("marks a required Checkbox both on the input and with the symbol", () => {
+ render( );
+
+ const checkbox = screen.getByRole("checkbox", { name: /약관에 동의/u });
+ expect(checkbox).toBeRequired();
+ const label = checkbox.closest("label");
+ if (!label) throw new Error("expected the checkbox label");
+ expect(within(label).getByText("*", { exact: false })).toHaveAttribute("aria-hidden", "true");
+ });
+});
+
+describe("Toast focus when it is closed", () => {
+ function Harness({ count }: Readonly<{ count: number }>) {
+ const toast = useToast();
+ return (
+ {
+ for (let index = 0; index < count; index += 1) {
+ toast.push({ id: `toast-${index}`, title: `알림 ${index}`, durationMs: 60_000 });
+ }
+ }}
+ >
+ 알림 보이기
+
+ );
+ }
+
+ it("moves focus to the next toast's close button", async () => {
+ const user = userEvent.setup();
+ render(
+
+
+ ,
+ );
+ await user.click(screen.getByRole("button", { name: "알림 보이기" }));
+ const [first] = screen.getAllByRole("button", { name: /닫기/u });
+ if (!first) throw new Error("expected two close buttons");
+ first.focus();
+
+ await user.click(first);
+
+ expect(document.activeElement).not.toBe(document.body);
+ expect(document.activeElement).toBe(screen.getByRole("button", { name: /닫기/u }));
+ });
+
+ it("returns focus to where it was before the last toast took it", async () => {
+ const user = userEvent.setup();
+ render(
+
+
+ ,
+ );
+ const trigger = screen.getByRole("button", { name: "알림 보이기" });
+ await user.click(trigger);
+ await user.tab();
+ const close = screen.getByRole("button", { name: /닫기/u });
+ expect(close).toHaveFocus();
+
+ await user.keyboard("{Enter}");
+
+ expect(screen.queryByRole("article")).not.toBeInTheDocument();
+ expect(trigger).toHaveFocus();
+ });
+});
+
+describe("TextArea counter", () => {
+ it("describes the field without announcing every key", async () => {
+ const user = userEvent.setup();
+ function Controlled() {
+ const [value, setValue] = useState("");
+ return setValue(event.currentTarget.value)} />;
+ }
+ render( );
+ const field = screen.getByRole("textbox", { name: "메모" });
+
+ await user.type(field, "가나다");
+
+ expect(screen.queryByRole("status")).not.toBeInTheDocument();
+ expect(field).toHaveAccessibleDescription(/27/u);
+ });
+});
diff --git a/tests/component/form-foundation.test.tsx b/tests/component/form-foundation.test.tsx
index 0b9d18b6..b066be89 100644
--- a/tests/component/form-foundation.test.tsx
+++ b/tests/component/form-foundation.test.tsx
@@ -26,6 +26,7 @@ import {
Form,
FormFailureStatus,
FormField,
+ FormSaveFeedback,
useAppForm,
useDirtyNavigationGuard,
validationMessage,
@@ -165,6 +166,11 @@ function FormHarness(props: Readonly<{
>;
resetOnSuccess?: boolean;
onFailureAction?(): void;
+ /** Resends the save an earlier mount left unknown (`resendUnknown`). */
+ resend?(): Promise<
+ | Readonly<{ ok: true; value: string }>
+ | Readonly<{ ok: false; error: ReturnType }>
+ >;
}>) {
const form = useAppForm({
schema,
@@ -179,6 +185,7 @@ function FormHarness(props: Readonly<{
submit: props.submit,
resetOnSuccess: props.resetOnSuccess,
});
+ const resend = props.resend;
return (
void form.submitForm(event)}>
form.settleApplied()}>Confirm applied
+ {resend ? (
+ void form.resendUnknown(resend)}>Resend
+ ) : null}
form.settleNotApplied()}>
Confirm not applied
@@ -632,6 +642,70 @@ describe("local form facade", () => {
});
});
+// 1106/08-01, 1106/03-01 (diff review FR-03), 1112/10-01. A page left while
+// its save was unknown comes back with a new form: the coordinator still
+// holds the unknown save, the form no longer knows the values it sent. The
+// values on screen were typed after the save and never sent, so no way out
+// of the unknown result may take them as the saved values: they and the
+// dirty state stay as they are, and the leave guard still protects them.
+describe("a form mounted again while its save is unknown", () => {
+ const leftUnknown = () =>
+ Promise.resolve({
+ ok: false as const,
+ error: createFailure("RATE_LIMITED", "CREATE_ENTITY", 0, {
+ effect: "NOT_APPLIED",
+ httpStatus: 429,
+ code: "RATE_LIMIT_EXCEEDED",
+ }),
+ });
+
+ it("keeps the values on screen when the earlier save is confirmed applied", async () => {
+ const user = userEvent.setup();
+ const submit = vi.fn();
+ render( );
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Beta");
+
+ await user.click(screen.getByRole("button", { name: "Confirm applied" }));
+
+ expect(screen.getByTestId("result")).toHaveTextContent("success");
+ expect(screen.getByRole("textbox", { name: /Name/ })).toHaveValue("Beta");
+ expect(screen.getByTestId("dirty")).toHaveTextContent("true");
+ expect(submit).not.toHaveBeenCalled();
+ });
+
+ it("keeps the values on screen when the resend succeeds", async () => {
+ const user = userEvent.setup();
+ const resend = vi.fn(async () => ({ ok: true as const, value: "saved" }));
+ render( );
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Beta");
+
+ await user.click(screen.getByRole("button", { name: "Resend" }));
+
+ await waitFor(() =>
+ expect(screen.getByTestId("result")).toHaveTextContent("success"),
+ );
+ expect(resend).toHaveBeenCalledTimes(1);
+ expect(screen.getByRole("textbox", { name: /Name/ })).toHaveValue("Beta");
+ expect(screen.getByTestId("dirty")).toHaveTextContent("true");
+ });
+
+ it("keeps the values on screen when a resend left unknown is then confirmed applied", async () => {
+ const user = userEvent.setup();
+ render( );
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Beta");
+ await user.click(screen.getByRole("button", { name: "Resend" }));
+ await waitFor(() =>
+ expect(screen.getByTestId("result")).toHaveTextContent("effect-unknown"),
+ );
+
+ await user.click(screen.getByRole("button", { name: "Confirm applied" }));
+
+ expect(screen.getByTestId("result")).toHaveTextContent("success");
+ expect(screen.getByRole("textbox", { name: /Name/ })).toHaveValue("Beta");
+ expect(screen.getByTestId("dirty")).toHaveTextContent("true");
+ });
+});
+
// 1101/14.4. Every code the paired backend can put in a field error's
// details[].code: clean-architecture-backend-template 5786126c,
// ClientSafeValidationDetails.java RULES (18-42) and its INVALID fallback.
@@ -1127,7 +1201,8 @@ describe("correcting a field after a server validation refusal", () => {
// 1101/14.4. Outside IDEMPOTENT_REQUEST_MISMATCH a 422 may come after a
// write (fileserver INTEGRITY_MISMATCH), so the coordinator holds it as an
- // unknown result even though the form shows the field.
+ // unknown result. 1101/03-04. The form shows that result, not the field it
+ // names: correcting the field would send a second save.
it("keeps the save off after a 422 the backend may have applied", async () => {
const user = userEvent.setup();
const fetcher = answerFirst(422, {
@@ -1141,8 +1216,11 @@ describe("correcting a field after a server validation refusal", () => {
await user.type(name, "Rejected");
await user.click(screen.getByRole("button", { name: "Submit" }));
- await waitFor(() => expect(name).toHaveAttribute("aria-invalid", "true"));
+ await waitFor(() =>
+ expect(screen.getByTestId("result")).toHaveTextContent("effect-unknown"),
+ );
+ expect(name).not.toHaveAttribute("aria-invalid");
expect(screen.getByRole("button", { name: "Submit" })).toBeDisabled();
expect(fetcher).toHaveBeenCalledTimes(1);
});
@@ -1273,3 +1351,367 @@ describe("correcting a field after a server validation refusal", () => {
expect(sentKeys(fetcher)).toEqual(["key-1", "key-1", "key-2"]);
});
});
+
+// 1112/01-01. The page used to hold the rules of a save through a mutation:
+// it refused a new save while the coordinator held one unknown or running,
+// and it wired the unknown-result surface's confirm and resend to the form.
+// A generated page kept its own copy, so a platform fix never reached it.
+// Now the form takes the mutation and FormSaveFeedback draws the feedback.
+describe("a form bound to its mutation", () => {
+ let token = 0;
+ const scope = {
+ ...scopeSnapshot(),
+ identities: createRuntimeIdentityRegistry({
+ tokenFactory: () => `bound-identity-token-${String(++token).padStart(4, "0")}`,
+ }),
+ };
+ const meta = { requestId: "request-1", traceId: "trace-1" };
+
+ function BoundForm(
+ props: Readonly<{
+ fetcher: typeof fetch;
+ operations?: typeof FORM_DECLARING_OPERATIONS;
+ onSaved?: (value: unknown) => void;
+ onConfirmed?: () => void;
+ /** Counts the saves the form hands to the mutation. */
+ onSubmit?: () => void;
+ }>,
+ ) {
+ const [http] = useState(() => formBinding(props.fetcher, props.operations));
+ const mutation = useApplicationMutation, unknown>({
+ definitionId: "form-bound-create-v1",
+ definitionVersion: 1,
+ operationId: commandMutationIdentity(FORM_CREATE_CONTRACT).operationId,
+ requiresIdempotencyKey: true,
+ owner: "platform-test",
+ duplicatePolicy: "REJECT_WHILE_ACTIVE",
+ scope,
+ invalidate: [],
+ execute: (command, { intent }) =>
+ http.execute("FORM_CREATE_ENTITY", { name: command.name }, { intent }),
+ });
+ const form = useAppForm({
+ schema,
+ defaultValues: defaults,
+ allowedServerFields: ["name", "note"],
+ mapToCommand: (values) => ({ name: values.name }),
+ submit: (command) => {
+ props.onSubmit?.();
+ return mutation.submit(command);
+ },
+ mutation,
+ ...(props.onSaved === undefined ? {} : { onSaved: props.onSaved }),
+ });
+ return (
+ void form.submitForm(event)}>
+
+
+
+ Submit
+
+
+
+
+ {form.result}
+ {mutation.state.indicator ?? "none"}
+ {String(form.pending)}
+ {String(form.dirty)}
+
+ );
+ }
+
+ function lostThen(...answers: Response[]) {
+ const fetcher = vi.fn().mockRejectedValueOnce(new TypeError("Failed to fetch"));
+ for (const answer of answers) fetcher.mockResolvedValueOnce(answer);
+ return fetcher.mockImplementation(async () =>
+ Response.json({ success: true, data: { id: "entity-1", name: "Saved" }, meta }),
+ );
+ }
+
+ async function loseFirstSave(
+ fetcher: typeof fetch,
+ props: Omit[0], "fetcher"> = {},
+ ) {
+ const user = userEvent.setup();
+ const client = queryClient();
+ const view = render( , { wrapper: wrapper(client) });
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Saved");
+ await user.click(screen.getByRole("button", { name: "Submit" }));
+ await screen.findByText(formatMessage("ko-KR", "async.mutationEffectUnknown"));
+ return { user, view, client };
+ }
+
+ /** The user leaves the page and comes back: a new form, the same mutation. */
+ function mountAgain(
+ view: ReturnType,
+ client: ReturnType,
+ props: Parameters[0],
+ ) {
+ view.unmount();
+ return render( , { wrapper: wrapper(client) });
+ }
+
+ /** A save the server answers only when the test says so. */
+ function heldSave() {
+ let answer: ((response: Response) => void) | undefined;
+ const fetcher = vi.fn(
+ () =>
+ new Promise((resolve) => {
+ answer = resolve;
+ }),
+ );
+ return {
+ fetcher,
+ answer: async () => {
+ await waitFor(() => expect(answer).toBeDefined());
+ answer?.(Response.json({ success: true, data: { id: "entity-1", name: "Saved" }, meta }));
+ },
+ };
+ }
+
+ // fe-testing (round9 confirm review). A form mounted again holds no
+ // submission of its own: only the coordinator's unknown result stops it.
+ it("refuses a new save in a form mounted again while the coordinator holds one unknown", async () => {
+ const fetcher = lostThen();
+ const { view, client } = await loseFirstSave(fetcher);
+ const submits = vi.fn();
+ const again = mountAgain(view, client, { fetcher, onSubmit: submits });
+ await screen.findByText(formatMessage("ko-KR", "async.mutationEffectUnknown"));
+ const form = again.container.querySelector("form");
+ if (!form) throw new Error("expected the form");
+ // A valid value of its own, so only the block stops the save.
+ fireEvent.change(screen.getByRole("textbox", { name: /Name/ }), {
+ target: { value: "Typed after coming back" },
+ });
+
+ fireEvent.submit(form);
+
+ // The form's own rule: it does not hand the save to the mutation at all.
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ expect(submits).not.toHaveBeenCalled();
+ expect(fetcher).toHaveBeenCalledTimes(1);
+ expect(screen.getByRole("button", { name: "Submit" })).toBeDisabled();
+ });
+
+ // 1105/08-04, moved here from the generated create page test (1112/01-01).
+ // The user comes back while the save they started still runs: the form
+ // shows it and sends nothing new.
+ it("shows a save it did not start and refuses a new one", async () => {
+ const user = userEvent.setup();
+ const held = heldSave();
+ const client = queryClient();
+ const view = render( , { wrapper: wrapper(client) });
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Saved");
+ await user.click(screen.getByRole("button", { name: "Submit" }));
+ await waitFor(() => expect(held.fetcher).toHaveBeenCalledTimes(1));
+
+ const again = mountAgain(view, client, { fetcher: held.fetcher });
+ const form = again.container.querySelector("form");
+ if (!form) throw new Error("expected the form");
+ fireEvent.submit(form);
+
+ expect(await screen.findByText(formatMessage("ko-KR", "async.mutationPending"))).toBeVisible();
+ expect(screen.getByRole("button", { name: "Submit" })).toBeDisabled();
+ expect(held.fetcher).toHaveBeenCalledTimes(1);
+ await held.answer();
+ });
+
+ // 1106/08-02, moved here from the generated create page test. A save that
+ // ends after the user left does not take them to what it saved.
+ it.each([
+ ["while the form is there", false, 1],
+ ["once the user left the form", true, 0],
+ ] as const)("opens what was saved only %s", async (_label, leave, opened) => {
+ const user = userEvent.setup();
+ const held = heldSave();
+ const onSaved = vi.fn();
+ const view = render( , {
+ wrapper: wrapper(queryClient()),
+ });
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Saved");
+ await user.click(screen.getByRole("button", { name: "Submit" }));
+ if (leave) view.unmount();
+
+ await held.answer();
+
+ await waitFor(() => expect(held.fetcher).toHaveBeenCalledTimes(1));
+ if (opened) await waitFor(() => expect(onSaved).toHaveBeenCalledTimes(1));
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ expect(onSaved).toHaveBeenCalledTimes(opened);
+ });
+
+ // 1105/08-02, moved here from the generated create page test. Confirming
+ // the unknown result hands over to the page (which opens the list).
+ it("hands over to the page once the user confirms the save applied", async () => {
+ const onConfirmed = vi.fn();
+ const { user } = await loseFirstSave(lostThen(), { onConfirmed });
+
+ await user.click(
+ screen.getByRole("button", { name: formatMessage("ko-KR", "action.confirmMutationApplied") }),
+ );
+
+ await waitFor(() => expect(onConfirmed).toHaveBeenCalledTimes(1));
+ expect(screen.getByTestId("indicator")).toHaveTextContent("none");
+ });
+
+ // 1112/01-02 영향 (round9 confirm review). Back on the page, the user typed
+ // a value the first save never had; the resend saves the first one. The
+ // page opens what was saved with the leave guard on: the typed value is
+ // still there and unsaved.
+ it("opens what a resend saved with the values it never sent still guarded", async () => {
+ const fetcher = lostThen();
+ const seen: string[] = [];
+ const onSaved = vi.fn(() => {
+ seen.push(
+ `pending=${screen.getByTestId("pending").textContent} dirty=${screen.getByTestId("dirty").textContent}`,
+ );
+ });
+ const { user, view, client } = await loseFirstSave(fetcher);
+ mountAgain(view, client, { fetcher, onSaved });
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Never sent");
+
+ await user.click(
+ await screen.findByRole("button", { name: formatMessage("ko-KR", "action.resendMutation") }),
+ );
+
+ await waitFor(() => expect(onSaved).toHaveBeenCalledTimes(1));
+ expect(seen).toEqual(["pending=false dirty=true"]);
+ expect(screen.getByRole("textbox", { name: /Name/ })).toHaveValue("Never sent");
+ });
+
+ // D-2 (round9 confirm review). The resend meets a sign-in: signing in
+ // again comes first, before the unknown result that is still held.
+ it("asks to sign in again before it shows the unknown result", async () => {
+ const fetcher = lostThen(
+ Response.json(
+ { success: false, error: { code: "UNAUTHENTICATED", category: "AUTH", retryable: false }, meta },
+ { status: 401 },
+ ),
+ );
+ const { user } = await loseFirstSave(fetcher);
+
+ await user.click(
+ screen.getByRole("button", { name: formatMessage("ko-KR", "action.resendMutation") }),
+ );
+
+ expect(await screen.findByText("계속하려면 로그인이 필요합니다.")).toBeVisible();
+ expect(
+ screen.queryByRole("button", { name: formatMessage("ko-KR", "action.resendMutation") }),
+ ).not.toBeInTheDocument();
+ });
+
+ // 1112/04-02, the declared 409. Not an input error: the feedback says it,
+ // and the "check what you entered" summary does not appear.
+ it("says a declared conflict in the feedback, not as an input error", async () => {
+ const user = userEvent.setup();
+ const fetcher = vi
+ .fn()
+ .mockResolvedValueOnce(
+ Response.json(
+ { success: false, error: { code: "POSTER_ALREADY_EXISTS", category: "CONFLICT", retryable: false }, meta },
+ { status: 409 },
+ ),
+ );
+ render( , {
+ wrapper: wrapper(queryClient()),
+ });
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Taken");
+
+ await user.click(screen.getByRole("button", { name: "Submit" }));
+
+ await waitFor(() => expect(screen.getByTestId("result")).toHaveTextContent("conflict"));
+ expect(screen.getByText(formatMessage("ko-KR", "form.conflict"))).toBeVisible();
+ expect(
+ screen.queryByRole("heading", { name: formatMessage("ko-KR", "form.errorSummary") }),
+ ).not.toBeInTheDocument();
+ });
+
+ it("refuses a new save while the coordinator holds one unknown", async () => {
+ const fetcher = lostThen();
+ const { view } = await loseFirstSave(fetcher);
+ const form = view.container.querySelector("form");
+ if (!form) throw new Error("expected the form");
+
+ fireEvent.submit(form);
+
+ expect(fetcher).toHaveBeenCalledTimes(1);
+ expect(screen.getByRole("button", { name: "Submit" })).toBeDisabled();
+ });
+
+ it("confirms the save applied through the form, which settles both", async () => {
+ const { user } = await loseFirstSave(lostThen());
+
+ await user.click(
+ screen.getByRole("button", { name: formatMessage("ko-KR", "action.confirmMutationApplied") }),
+ );
+
+ await waitFor(() => expect(screen.getByTestId("result")).toHaveTextContent("success"));
+ expect(screen.getByTestId("indicator")).toHaveTextContent("none");
+ });
+
+ // UX-02 (1112/04-02). The same-key resend was refused before the write: the
+ // save is still unknown, and the words say so where the unknown result is,
+ // not under the "check what you entered" summary.
+ it("says a resend refused before the write in the feedback, not as an input error", async () => {
+ const fetcher = lostThen(
+ Response.json(
+ {
+ success: false,
+ error: { code: "RATE_LIMIT_UNAVAILABLE", category: "TRANSIENT_DEPENDENCY", retryable: true },
+ meta,
+ },
+ { status: 503 },
+ ),
+ );
+ const { user } = await loseFirstSave(fetcher);
+
+ await user.click(
+ screen.getByRole("button", { name: formatMessage("ko-KR", "action.resendMutation") }),
+ );
+
+ await waitFor(() => expect(fetcher).toHaveBeenCalledTimes(2));
+ // The harness's elements are statuses too: find the words, then
+ // the unknown result's status around them.
+ const notice = await screen.findByText(formatMessage("ko-KR", "form.resendLater"));
+ expect(notice.closest('[role="status"]')).toHaveTextContent(
+ formatMessage("ko-KR", "async.mutationEffectUnknown"),
+ );
+ expect(
+ screen.queryByRole("heading", { name: formatMessage("ko-KR", "form.errorSummary") }),
+ ).not.toBeInTheDocument();
+ expect(screen.getByTestId("result")).toHaveTextContent("effect-unknown");
+ });
+});
+
+// 1101/03-04. A failure that is both a field refusal and possibly applied
+// (a feature's mapProblem says VALIDATION_REJECTED, the classifier
+// MAYBE_APPLIED) shows the unknown result only: correcting the field would
+// send a second save of something that may already be saved.
+describe("a possibly applied failure that names a field", () => {
+ it("shows the unknown result, not a field error", async () => {
+ const user = userEvent.setup();
+ const submit = vi.fn(async () => ({
+ ok: false as const,
+ error: createFailure("VALIDATION_REJECTED", "CREATE_ENTITY", 0, {
+ effect: "MAYBE_APPLIED",
+ validationIssues: [{ path: "name", code: "SIZE" }],
+ }),
+ }));
+ render( );
+ await user.type(screen.getByRole("textbox", { name: /Name/ }), "Alpha");
+
+ await user.click(screen.getByRole("button", { name: "Submit" }));
+
+ await waitFor(() => expect(screen.getByTestId("result")).toHaveTextContent("effect-unknown"));
+ expect(screen.getByRole("textbox", { name: /Name/ })).not.toHaveAccessibleDescription(/./u);
+ });
+});
diff --git a/tests/component/starter-pages.test.tsx b/tests/component/starter-pages.test.tsx
index d0e2734e..dd634d43 100644
--- a/tests/component/starter-pages.test.tsx
+++ b/tests/component/starter-pages.test.tsx
@@ -5,7 +5,7 @@ import userEvent from "@testing-library/user-event";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it } from "vitest";
-import { LocaleProvider } from "../../src/presentation/i18n/index.ts";
+import { formatMessage, LocaleProvider } from "../../src/presentation/i18n/index.ts";
import HomePage from "../../src/presentation/pages/home-page.tsx";
import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
import { PreferenceProviders } from "../../src/presentation/providers/preference-providers.tsx";
@@ -35,6 +35,16 @@ function renderApp(
}
describe("starter home page", () => {
+ // 1112/05-15. A generic div's aria-label is dropped by assistive technology;
+ // the readiness list is a named group.
+ it("names the readiness list as a group", async () => {
+ renderApp("/");
+
+ expect(
+ await screen.findByRole("group", { name: formatMessage("ko-KR", "home.readiness") }),
+ ).toBeVisible();
+ });
+
it("reaches the platform overview from the starter actions", async () => {
const user = userEvent.setup();
renderApp("/");
diff --git a/tests/e2e/app-shell.spec.ts b/tests/e2e/app-shell.spec.ts
index b9d15e8e..c49dcb5c 100644
--- a/tests/e2e/app-shell.spec.ts
+++ b/tests/e2e/app-shell.spec.ts
@@ -24,6 +24,34 @@ test("navigates to a registry-backed example without a page reload", async ({
).toBeFocused();
});
+// 1112/05-02. The route heading takes focus on every navigation. A keyboard
+// user must see it (M2); a pointer user may not need the ring.
+test("shows the focus ring on the route heading after keyboard navigation only", async ({
+ page,
+}) => {
+ await page.goto("/");
+ // The home route renders after the shell: focus given before it is there
+ // goes with the node it lands on, and Enter then does nothing (WebKit).
+ await expect(page.getByRole("heading", { level: 1 })).toHaveText("Clean Architecture Frontend");
+ const link = page
+ .getByRole("navigation", { name: "주요 탐색" })
+ .getByRole("link", { name: "플랫폼 구성" });
+ await link.focus();
+ await expect(link).toBeFocused();
+ await page.keyboard.press("Enter");
+ const heading = page.getByRole("heading", { level: 1, name: "플랫폼 구성" });
+ await expect(heading).toBeFocused();
+ expect(await heading.evaluate((element) => getComputedStyle(element).outlineStyle)).not.toBe("none");
+
+ await page
+ .getByRole("navigation", { name: "주요 탐색" })
+ .getByRole("link", { name: "홈" })
+ .click();
+ const home = page.getByRole("heading", { level: 1 });
+ await expect(home).toBeFocused();
+ expect(await home.evaluate((element) => getComputedStyle(element).outlineStyle)).toBe("none");
+});
+
test("provides an escape-dismissible mobile navigation", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/");
diff --git a/tests/e2e/generated-feature.spec.ts b/tests/e2e/generated-feature.spec.ts
index 9766186f..fd864fe3 100644
--- a/tests/e2e/generated-feature.spec.ts
+++ b/tests/e2e/generated-feature.spec.ts
@@ -225,6 +225,24 @@ test.describe("the form", () => {
}));
expect(viewport.scrollWidth).toBeLessThanOrEqual(viewport.clientWidth);
});
+
+ // round9 confirm review. The page always hands FormSaveFeedback to the
+ // template's feedback area; with nothing to say it takes no row, so the
+ // heading and the fields stay one gap apart.
+ test("leaves no room for a save feedback area with nothing to say", async ({ page }) => {
+ await openForm(page);
+ const spacing = await page.evaluate(() => {
+ const box = (selector: string) => document.querySelector(selector)?.getBoundingClientRect();
+ const heading = box(".page-template__heading");
+ const layout = box(".page-template__layout");
+ const template = document.querySelector(".page-template");
+ return heading && layout && template
+ ? { between: layout.top - heading.bottom, rowGap: parseFloat(getComputedStyle(template).rowGap) }
+ : null;
+ });
+ expect(spacing).not.toBeNull();
+ expect(spacing?.between).toBeCloseTo(spacing?.rowGap ?? 0, 0);
+ });
});
test.describe("the save", () => {
diff --git a/tests/storybook/galleries.spec.ts b/tests/storybook/galleries.spec.ts
index 51ffdee2..8b1379e6 100644
--- a/tests/storybook/galleries.spec.ts
+++ b/tests/storybook/galleries.spec.ts
@@ -23,6 +23,29 @@ async function openDesignSystemGallery(page: Page) {
).toBeVisible();
}
+// 1112/05-06. WCAG 1.4.13 hoverable: the pointer can move from the trigger
+// onto the tooltip, across the gap between them, and the tooltip stays.
+test("keeps a tooltip shown while the pointer moves onto it", async ({ page }) => {
+ await openDesignSystemGallery(page);
+ await page.getByRole("button", { name: "도움말" }).hover();
+ const tooltip = page.getByRole("tooltip", { name: "이 설명은 필수 정보가 아닙니다." });
+ await expect.poll(() => tooltip.evaluate((element) => getComputedStyle(element).opacity)).toBe("1");
+ const box = await tooltip.boundingBox();
+ if (!box) throw new Error("expected the tooltip box");
+
+ // The hover that shows it holds in the gap and over the tooltip itself:
+ // read where it is decided, not only the opacity, which fades over 100 ms
+ // and still reads 1 the moment the hover is lost.
+ const stillHovered = () =>
+ tooltip.evaluate((element) => element.closest(".ui-tooltip")?.matches(":hover") ?? false);
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height + 2, { steps: 4 });
+ expect(await stillHovered()).toBe(true);
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, { steps: 4 });
+ expect(await stillHovered()).toBe(true);
+
+ await expect.poll(() => tooltip.evaluate((element) => getComputedStyle(element).opacity)).toBe("1");
+});
+
test("validates and reports the common text-field flow", async ({ page }) => {
await openDesignSystemGallery(page);
await page.getByRole("button", { name: "입력 확인" }).click();
diff --git a/tests/unit/create-feature.test.ts b/tests/unit/create-feature.test.ts
index 222b50b6..0cff8854 100644
--- a/tests/unit/create-feature.test.ts
+++ b/tests/unit/create-feature.test.ts
@@ -268,18 +268,18 @@ describe("create:feature --with-create", () => {
// 1105/08-04. Like the reference form: while a save this page did not
// start holds the coordinator, the save is off and the feedback says a
// save is running, instead of a save button that does nothing.
+ // 1112/01-01. The rule is the platform form's (useAppForm `mutation`,
+ // FormSaveFeedback; tests/component/form-foundation.test.tsx walks it):
+ // the page turns the button off from the form's state.
it("keeps the create's save off and says so while another save of it runs", () => {
const page =
plan({ id: "invoice-feature", write: "NEVER" }).files.get(
"src/features/invoice-feature/presentation/invoice-create-page.tsx",
) ?? "";
- expect(page).toContain(
- 'const otherSaveRunning = mutation.state.indicator === "mutation-pending" && !form.pending;',
- );
- expect(page).toContain("disabled={effectUnknown || otherSaveRunning}");
- expect(page).toContain('otherSaveRunning && form.result !== "effect-unknown" ? (');
- expect(page).toContain(" ");
+ expect(page).toContain("disabled={form.effectUnknown || form.otherSaveRunning}");
+ expect(page).toContain(" {
// 1106/08-02. A save that ended after the user left the form took them to
// the item anyway. The page opens the item or the list only while it is
// still mounted, and the generated page test walks that path.
+ // 1112/01-01. "While mounted" is the platform form's rule: the page opens
+ // the item in `onSaved` and the list in FormSaveFeedback's `onConfirmed`,
+ // which the form calls only while it is mounted.
it.each(["NEVER", "KEYED"] as const)(
"does not open the item when the user left during a %s create",
(write) => {
@@ -309,10 +312,9 @@ describe("create:feature --with-create", () => {
const page =
files.get("src/features/invoice-feature/presentation/invoice-create-page.tsx") ?? "";
- expect(page).toContain("if (outcome?.ok && mounted.current) {");
- expect(page).toContain(
- 'if (mounted.current) void navigate(invoiceRouteUrl("INVOICE_LIST"));',
- );
+ expect(page).toContain("onSaved: (item) => {");
+ expect(page).toContain("onConfirmed={() => {");
+ expect(page).not.toContain("mounted");
expect(
files.get("tests/features/invoice-feature/invoice-create-page.test.tsx"),
).toContain('it("stays on the list the user went to while the create was saving"');
@@ -569,3 +571,30 @@ describe("create:feature writing", () => {
await expect(access(path.join(root, "src"))).rejects.toThrow();
});
});
+
+// 1112/01-01. The generated create page leaves the rules of a save through
+// its mutation to the platform form: it gives useAppForm the mutation and
+// draws FormSaveFeedback, so a platform fix to those rules reaches it.
+describe("generated create page", () => {
+ it("hands the save rules to the platform form", () => {
+ const { files } = plan({ id: "invoice-feature", write: "KEYED" });
+ const page = files.get("src/features/invoice-feature/presentation/invoice-create-page.tsx") ?? "";
+
+ expect(page).toContain(" mutation,\n");
+ expect(page).toContain(" {
+ const { files } = plan({ id: "invoice-feature", write: "KEYED" });
+ const page = files.get("src/features/invoice-feature/presentation/invoice-create-page.tsx") ?? "";
+
+ expect(page).toContain("onSaved:");
+ expect(page).not.toMatch(/useRef|useEffect|mounted/u);
+ expect(page).not.toMatch(/resendUnknown|settleApplied|onResent/u);
+ });
+});
diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png
index eef93379..221a44b5 100644
Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png differ
diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/design-system-gallery-dark-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/design-system-gallery-dark-chromium-visual-linux.png
index 9630af27..3484f89d 100644
Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/design-system-gallery-dark-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/design-system-gallery-dark-chromium-visual-linux.png differ
diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png
index 8487c073..beb8e3d4 100644
Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png differ
diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/state-surfaces-light-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/state-surfaces-light-chromium-visual-linux.png
index d3f14c04..382c7646 100644
Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/state-surfaces-light-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/state-surfaces-light-chromium-visual-linux.png differ