fix(control-plane): bridge whynot-design forms into native submission

wn-input/wn-select/wn-button aren't form-associated custom elements —
their real <input>/<select>/<button> live inside shadow DOM, invisible
to an ancestor <form>. Clicking Sign In (or any wn-button[type=submit])
silently did nothing, and even a submitted form would have carried none
of the field values. Bridges both gaps generically in base.html without
touching the vendored library: mirrors each shadow-DOM control's live
value into a hidden native input on submit, and explicitly calls
form.requestSubmit() on wn-button[type=submit] clicks.

Reported by the user clicking Sign In in the running local instance —
missed by test_control_plane_app.py because TestClient POSTs directly
and never exercises real button clicks or shadow DOM.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-07-30 16:46:31 +02:00
parent 87ccf37b59
commit e103937e21
2 changed files with 58 additions and 0 deletions

View file

@ -287,3 +287,19 @@ def test_audit_log_visible_to_signed_in_user(client, credentials):
_login(client, credentials["viewer"].token)
resp = client.get("/audit")
assert resp.status_code == 200
def test_form_bridge_script_present(client):
"""whynot-design's wn-input/wn-select/wn-button are not
form-associated custom elements their real <input>/<select>/
<button> live inside shadow DOM, invisible to an ancestor <form>. A
plain click on wn-button[type=submit] silently does nothing, and
even a submitted form would carry none of the field values. This
only regressed once (base.html's bridging script), so pin its
presence TestClient can't click a real button/shadow DOM, this is
the closest offline check available without a browser-automation
tool."""
resp = client.get("/login")
assert "wn-button[type=submit]" in resp.text
assert "requestSubmit" in resp.text
assert "data-wn-mirror-for" in resp.text