diff --git a/plugins/sirius-press-auth/assets/login.css b/plugins/sirius-press-auth/assets/login.css index 75e66f7..2bd6d84 100644 --- a/plugins/sirius-press-auth/assets/login.css +++ b/plugins/sirius-press-auth/assets/login.css @@ -7,6 +7,24 @@ * as the way in, and the password field above it reads as a leftover. */ +/* + * Make the `hidden` attribute actually hide things. + * + * `hidden` works through a UA rule — `[hidden] { display: none }` — which any + * author rule carrying a `display` outranks. WordPress ships exactly such a + * rule: `.wp-core-ui .button { display: inline-block }` in buttons.css, which + * matches every button in this block. + * + * Without this the whole progressive-enhancement story silently inverts. The + * markup ships with the sign-in button, the browser-wallet button and the + * phrase field hidden, and the script reveals only the ones that can work. + * Defeat `hidden` and a visitor with JavaScript off is offered a button that + * does nothing, and everyone is offered a browser wallet that is not there. + */ +.sirius-wallet [hidden] { + display: none !important; +} + .sirius-wallet { margin: 16px 0 8px; padding: 16px; diff --git a/plugins/sirius-press-auth/assets/login.js b/plugins/sirius-press-auth/assets/login.js index b7049cb..2069d20 100644 --- a/plugins/sirius-press-auth/assets/login.js +++ b/plugins/sirius-press-auth/assets/login.js @@ -33,6 +33,17 @@ function submitForm(block) { const form = block.closest("form"); if (!form) return; + + // WordPress marks its username and password inputs `required`, and the + // wallet path deliberately leaves both empty — the signature is the + // credential. Constraint validation would otherwise refuse the submit and + // point a "Please fill out this field" bubble at an input the visitor is + // not supposed to touch, with the signature already sitting in the form. + // + // Only reached from the wallet buttons, so password sign-in keeps its + // validation. + form.noValidate = true; + if (typeof form.requestSubmit === "function") { form.requestSubmit(); } else {