A refused form keeps what was typed

When the server refuses a form POST (422), it draws the same form again with what the person typed still in it, and the message sits beside the field it is about, linked with aria-describedby, with focus on the first field that has a message. Nothing above the form moves.

api_key, otp, pin, as whole words), is never sent back: the person types it again.

Where it lives: refused and kept in src/web/form.ts; a page builds one Refused from the form and its messages and passes each field through kept. First users: the profile form (display name, email, commit email) and the password change. Also kept, each by its own page: sign-in (the username, never the password, the failing password field marked), a new repository (a refused or taken name is marked on the Name field) and a new issue (the title marked). Other forms still use their own error handling: #14003, #14004.

Try it: open /settings/password, type different new and confirm passwords, submit; the message sits beside New password with focus and no password is echoed. Or give /settings an email of not an email.

The terminal (both doors): it has no HTML forms and no profile or password screen. A refused write there shows the reason as a danger toast (ctx.toast(errorText(...), "danger") in src/tui) and leaves the screen as it was; nothing changes in the terminal.

Pinned by test/form-keeps-input.test.ts and test/form-keep.test.ts (a bad value on three forms; the kept text escaped).

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs