fix(signup): stop an unsolved anti-spam check clearing the form, and say what the check is #171

Sammanfogat
supernaut sammanfogade 2 incheckningar från fix/signup-captcha-ux in i main 2026-08-02 19:47:47 +00:00
Ägare

Closes #162, closes #163.

#162 — an unsolved anti-spam check no longer clears the form.

The captcha was the only control on the form without a native constraint. Every other field has
required, pattern or type="email", so the browser already blocks an incomplete submit; the
captcha did not, which is why it was the one that appeared to wipe everything. /api/signup answers
every outcome with a 303 to /signup?status=… and the re-rendered form echoes nothing, so the
response was a fresh empty page.

cap-widget is a form-associated custom element and already implements this: given required it
sets valueMissing validity and scrolls itself into view on invalid. So the form never leaves the
page and there is nothing to restore. Because the validity anchor lives in the widget's shadow root,
an always-rendered role="alert" message is unhidden from an invalid listener — a colour flash
alone is not accessible. It is re-hidden on solve so a stale complaint cannot sit under a solved
widget.

Verified in a real browser: with username, email and terms filled and only the captcha missing,
formValid: false, the URL never gains a ?status= parameter — so no request reached the endpoint
— and every field retains its value.

#163 — the check now explains itself, in both languages.

A visitor who has met the usual third-party image puzzles has no way to know this one is
self-hosted, image-free and does no tracking. Adds a permanent description to both forms, wired
through aria-describedby on the wrapper role="group" — not on <cap-widget>, which has no ARIA
role of its own. The description id is rendered unconditionally, so the dangling-id shape fixed in
#146 is not reintroduced.

Also adds a <noscript> line: the token field is created at runtime and the solver is WebAssembly,
so with JavaScript off sign-up cannot succeed at all — and today the only way to discover that is to
submit and be told the check failed.

docs/content-style.md gains the Swedish house term "arbetsbevis (proof of work)" so it stops
being decided per writer.

Not in scope

Preserving typed values after a server-side rejection (taken, ratelimited, error, nomail)
is #164 and needs a privacy-policy decision first. No draft cookie is added here.

Verification

pnpm lint, pnpm check, pnpm lang-check, pnpm test (206), pnpm test:e2e and pnpm mdlint
all clean.

Closes #162, closes #163. **#162 — an unsolved anti-spam check no longer clears the form.** The captcha was the only control on the form without a native constraint. Every other field has `required`, `pattern` or `type="email"`, so the browser already blocks an incomplete submit; the captcha did not, which is why it was the one that appeared to wipe everything. `/api/signup` answers every outcome with a 303 to `/signup?status=…` and the re-rendered form echoes nothing, so the response was a fresh empty page. `cap-widget` is a form-associated custom element and already implements this: given `required` it sets `valueMissing` validity and scrolls itself into view on `invalid`. So the form never leaves the page and there is nothing to restore. Because the validity anchor lives in the widget's shadow root, an always-rendered `role="alert"` message is unhidden from an `invalid` listener — a colour flash alone is not accessible. It is re-hidden on `solve` so a stale complaint cannot sit under a solved widget. Verified in a real browser: with username, email and terms filled and only the captcha missing, `formValid: false`, the URL never gains a `?status=` parameter — so no request reached the endpoint — and every field retains its value. **#163 — the check now explains itself, in both languages.** A visitor who has met the usual third-party image puzzles has no way to know this one is self-hosted, image-free and does no tracking. Adds a permanent description to both forms, wired through `aria-describedby` on the wrapper `role="group"` — not on `<cap-widget>`, which has no ARIA role of its own. The description id is rendered unconditionally, so the dangling-id shape fixed in #146 is not reintroduced. Also adds a `<noscript>` line: the token field is created at runtime and the solver is WebAssembly, so with JavaScript off sign-up cannot succeed at all — and today the only way to discover that is to submit and be told the check failed. `docs/content-style.md` gains the Swedish house term **"arbetsbevis (proof of work)"** so it stops being decided per writer. ### Not in scope Preserving typed values after a *server-side* rejection (`taken`, `ratelimited`, `error`, `nomail`) is #164 and needs a privacy-policy decision first. No draft cookie is added here. ### Verification `pnpm lint`, `pnpm check`, `pnpm lang-check`, `pnpm test` (206), `pnpm test:e2e` and `pnpm mdlint` all clean.
supernaut tvångsskickade fix/signup-captcha-ux från 5d71aacab7
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m15s
till 6b3db94a07
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m21s
2026-08-02 19:38:48 +00:00
Jämför
supernaut sammanfogade incheckning 1740eff052 till main 2026-08-02 19:47:47 +00:00
supernaut tog bort grenen fix/signup-captcha-ux 2026-08-02 19:47:47 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web!171
Ingen beskrivning angiven.