From 8608e71c7eddcf8ac4f261408c05e2235bec1c10 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 09:12:07 +0000 Subject: [PATCH] The password box was a browser default under a styled username box MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit board.css styled form controls from a list — text, email, date, and inputs with no type attribute at all. The username field on the sign-in page has no type, so it got the full-width box; the password field has one, and `password` was never in the list, so it kept the browser's own narrow grey rectangle directly beneath it. The number box for a page's order, added two days ago, was unstyled for the same reason and nobody had looked at it yet. An allowlist of accepted types is wrong the moment somebody adds a field, and wrong silently: nothing errors, the form just looks unfinished. So the rule is written the other way round — it excludes the controls that are not text boxes (checkbox, radio, file, and the button-like types) and styles everything else, so password, number, url, search and whatever arrives next are covered without anybody remembering to edit it. The guard in test_templates.py is on the shape of the rule rather than on any one type: a revert to listing accepted types fails it. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn --- apps/board/static/board.css | 20 +++++++++++++++--- apps/board/tests/test_templates.py | 33 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/apps/board/static/board.css b/apps/board/static/board.css index e5b25f1..4d3f819 100644 --- a/apps/board/static/board.css +++ b/apps/board/static/board.css @@ -180,8 +180,22 @@ label { display: block; margin: 1rem 0 0.35rem; font-weight: 600; font-size: 0.9 label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; } label.check input { margin: 0; } -input[type="text"], input[type="email"], input[type="date"], -input:not([type]), select, textarea { +/* Everything a person types in, named by what it is NOT. + * + * This was a list — text, email, date and inputs with no type at all — and a + * list of accepted types is wrong the moment somebody adds one. It was: the + * password box on the sign-in page was a browser default sitting under a + * full-width username box, because `password` was never added, and so was the + * number box for a page's order. Nothing errors; the form just looks unfinished + * in a way only a person looking at it can catch. + * + * The controls below are excluded because they are not text boxes and would be + * disfigured by this: a checkbox, a radio, a file picker (styled separately), + * and the button-like types. Anything else — password, number, url, search, + * tel, whatever arrives next — is a field somebody types in and gets the same + * box without this rule having to be edited again. */ +input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="hidden"]), +select, textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border-light); @@ -189,7 +203,7 @@ input:not([type]), select, textarea { background: var(--bg); color: var(--text); } -input[type="checkbox"] { width: auto; } +input[type="checkbox"], input[type="radio"] { width: auto; } textarea { resize: vertical; line-height: 1.55; } :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; } diff --git a/apps/board/tests/test_templates.py b/apps/board/tests/test_templates.py index 4259ac0..8c29daa 100644 --- a/apps/board/tests/test_templates.py +++ b/apps/board/tests/test_templates.py @@ -174,3 +174,36 @@ def test_the_fields_that_are_not_prose_stay_plain(): html = (Path(__file__).resolve().parents[1] / "templates" / name).read_text(encoding="utf-8") opening = re.search(rf'