chore(release): v1.4.47 — audit-backlog closure + drag-to-reorder + Coach disable + OAuth nonce ledger

Eight changes: W0 idempotency test pin, W1 legacy column drop, W2 Textarea primitive, W3 Coach disable toggle, W4 dnd-kit drag-to-reorder, W5 onboarding 24h gate, W6 Withings OAuth nonce ledger, W7+W8 legacy_form_total drop + Coach onLine pre-check. 6-axis QA reconciled. Migrations 0076/0077/0078 required pre-image. Tests 5093 → ~5170.
This commit is contained in:
Marc-André Bombeck authored and GitHub committed 2026-05-22 09:18:52 +02:00
1 parent ac319c6160
commit 66a7f8b6fa
68 files changed
+3959 -715

No files matched your search

@@ -0,0 +1,93 @@
import { describe, expect, it } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { Textarea } from "../textarea";
describe("<Textarea>", () => {
it("pins text-base on mobile and shrinks to text-sm on sm+ (iOS zoom defence)", () => {
const html = renderToStaticMarkup(<Textarea id="note" />);
expect(html).toContain("text-base");
expect(html).toContain("sm:text-sm");
});
it("floors at min-h-11 on mobile and min-h-9 on sm+ (WCAG 2.5.5 tap target)", () => {
const html = renderToStaticMarkup(<Textarea id="note" />);
expect(html).toContain("min-h-11");
expect(html).toContain("sm:min-h-9");
});
it("defaults autoComplete to off and tells password managers to skip", () => {
const html = renderToStaticMarkup(<Textarea id="note" />);
expect(html).toContain('autoComplete="off"');
expect(html).toContain('data-lpignore="true"');
expect(html).toContain('data-1p-ignore="true"');
});
it("defaults autoCapitalize to sentences for prose-like free-text input", () => {
const html = renderToStaticMarkup(<Textarea id="note" />);
expect(html).toContain('autoCapitalize="sentences"');
});
it("enables spellCheck by default", () => {
const html = renderToStaticMarkup(<Textarea id="note" />);
expect(html).toContain('spellCheck="true"');
});
it("emits the data-slot attribute (shadcn convention)", () => {
const html = renderToStaticMarkup(<Textarea id="note" />);
expect(html).toContain('data-slot="textarea"');
});
it("allows callers to override autoCapitalize for code / JSON input", () => {
const html = renderToStaticMarkup(
<Textarea id="json" autoCapitalize="none" spellCheck={false} />,
);
expect(html).toContain('autoCapitalize="none"');
expect(html).not.toContain('spellCheck="true"');
});
it("respects an explicit autoComplete value and drops the ignore attrs", () => {
const html = renderToStaticMarkup(<Textarea id="bio" autoComplete="on" />);
expect(html).toContain('autoComplete="on"');
expect(html).not.toContain('data-lpignore="true"');
expect(html).not.toContain('data-1p-ignore="true"');
});
it("merges caller className via cn() without dropping defaults", () => {
const html = renderToStaticMarkup(
<Textarea id="note" className="font-mono" />,
);
expect(html).toContain("font-mono");
// iOS zoom defence still present after merge
expect(html).toContain("text-base");
expect(html).toContain("sm:text-sm");
});
it("is wrapped in React.forwardRef so refs reach the <textarea>", () => {
// React tags forwardRef components with a sentinel symbol on
// `$$typeof`. Verifying the sentinel keeps the assertion
// dependency-free (no testing-library / DOM env needed) while
// still catching a regression that strips the wrapper.
const forwardRefSymbol = Symbol.for("react.forward_ref");
const componentMeta = Textarea as unknown as {
$$typeof: symbol;
render?: unknown;
};
expect(componentMeta.$$typeof).toBe(forwardRefSymbol);
expect(typeof componentMeta.render).toBe("function");
});
it("forwards rows / placeholder / maxLength to the underlying element", () => {
const html = renderToStaticMarkup(
<Textarea
id="note"
rows={8}
placeholder="Tell us more"
maxLength={5000}
/>,
);
expect(html).toContain('rows="8"');
expect(html).toContain('placeholder="Tell us more"');
expect(html).toContain('maxLength="5000"');
});
});
+76
View File
@@ -0,0 +1,76 @@
import * as React from "react";
import { cn } from "@/lib/utils";
/**
* Base textarea primitive — mirror of `<Input>` for multi-line input.
*
* v1.4.47 W2 — extracted the iOS-zoom defence + tap-target floor +
* autocomplete defaults that the bugreport / medications-import /
* side-effects / admin-feedback textareas were copy-pasting into a
* single primitive. Six call sites previously each maintained their
* own className string; any drift between them was a paper-cut waiting
* to happen.
*
* What it bakes in:
*
* - `text-base sm:text-sm` — iOS Safari zooms the viewport on
* focus when the font-size renders below 16 px, which yanks the
* keyboard up and leaves the user lost. 16 px on mobile holds
* the viewport; 14 px on `sm`+ keeps the compact desktop look.
*
* - `min-h-11 sm:min-h-9` — WCAG 2.5.5 / Apple HIG floor of 44 px
* on touch screens, shrinking to 36 px once we know we have a
* pointer (covers `rows={1}` single-line uses without dropping
* under the tap-target floor).
*
* - `autoCapitalize="sentences"` — free-text fields read as prose
* on iOS / Android by default. Caller can override with `"none"`
* for code / JSON / IDs.
*
* - `spellCheck` defaults to `true` — same reasoning.
*
* - `autoComplete` defaults to `"off"` for the same reason as
* `<Input>`: HealthLog is a health-data app, and we don't want
* a password manager pasting the user's saved password into a
* free-text textarea that we then persist server-side. Caller
* can opt back in (e.g. `"on"`) per field.
*
* Composition is via `cn(…)` so callers can override anything — the
* primitive defaults are the strict pass, not the only pass.
*/
const Textarea = React.forwardRef<
HTMLTextAreaElement,
React.ComponentProps<"textarea">
>(function Textarea(
{ className, autoComplete, autoCapitalize, spellCheck, ...props },
ref,
) {
const resolvedAutoComplete = autoComplete ?? "off";
const resolvedAutoCapitalize = autoCapitalize ?? "sentences";
const resolvedSpellCheck = spellCheck ?? true;
const skipAutofill = resolvedAutoComplete === "off";
return (
<textarea
ref={ref}
data-slot="textarea"
autoComplete={resolvedAutoComplete}
autoCapitalize={resolvedAutoCapitalize}
spellCheck={resolvedSpellCheck}
data-lpignore={skipAutofill ? "true" : undefined}
data-1p-ignore={skipAutofill ? "true" : undefined}
className={cn(
// iOS zoom defence + WCAG 2.5.5 tap-target floor; see the
// primitive's docblock for the full reasoning.
"border-input bg-background text-foreground placeholder:text-muted-foreground dark:bg-input/30 min-h-11 w-full rounded-md border px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 sm:min-h-9 sm:text-sm",
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
className,
)}
{...props}
/>
);
});
export { Textarea };