Fix: signup page services message shift to warning/successful messages

This commit is contained in:
hyzen
2026-06-13 15:15:36 +05:30
parent 25d7f545cf
commit f974308b74
4 changed files with 56 additions and 31 deletions

View File

@@ -1085,10 +1085,12 @@
/* ── Auth pages (login / signup) ───────────────────────────────────────── */ /* ── Auth pages (login / signup) ───────────────────────────────────────── */
.auth-page__services { .auth-page__services {
margin-top: 25px; margin-top: 0;
margin-bottom: -25px; margin-bottom: 0.75rem;
font-size: 0.78rem; font-size: 0.78rem;
line-height: 1.45; line-height: 1.45;
color: var(--foreground-color);
display: block;
} }
.services-group__title { .services-group__title {
@@ -1114,12 +1116,12 @@
background: var(--background-color); background: var(--background-color);
} }
/* Message banner — fixed height always reserved so the form never shifts */ /* Message banner — always in flow; min-height reserves space so the form never shifts */
.auth-message { .auth-message {
border-radius: 4px; border-radius: 4px;
font-size: 0.82rem; font-size: 0.82rem;
line-height: 1.3; line-height: 1.4;
height: 1.8rem; min-height: 1.8rem;
margin-bottom: 0.75rem; margin-bottom: 0.75rem;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid transparent; border: 1px solid transparent;
@@ -1127,10 +1129,7 @@
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
transition: opacity 0.15s ease; transition: opacity 0.15s ease;
overflow: hidden; padding: 0.25rem 0.7rem;
display: flex;
align-items: center;
padding: 0 0.7rem;
} }
.auth-message.is-visible { .auth-message.is-visible {
@@ -1138,6 +1137,12 @@
pointer-events: auto; pointer-events: auto;
} }
.auth-message--info {
background: transparent;
border-color: transparent;
color: var(--foreground-color);
}
.auth-message--error { .auth-message--error {
background: rgba(255, 61, 61, 0.1); background: rgba(255, 61, 61, 0.1);
border: 1px solid rgba(255, 61, 61, 0.4); border: 1px solid rgba(255, 61, 61, 0.4);

File diff suppressed because one or more lines are too long

View File

@@ -2,17 +2,23 @@
<div class="auth-page"> <div class="auth-page">
<div class="auth-card"> <div class="auth-card">
<h1 class="auth-page__title">{{ .Title }}</h1> <h1 class="auth-page__title">{{ .Title }}</h1>
{{ with site.GetPage "/services" }} {{ $registrationServices := slice }} {{ range {{- with site.GetPage "/services" -}} {{- $registrationServices := slice -}} {{- range
.Pages.ByWeight }} {{ if index .Params "registration-needed" }} {{ $registrationServices = .Pages.ByWeight -}} {{- if index .Params "registration-needed" -}} {{- $registrationServices
$registrationServices | append . }} {{ end }} {{ end }} {{ with $registrationServices }} = $registrationServices | append . -}} {{- end -}} {{- end -}} {{- with
<p class="auth-page__services"> $registrationServices -}} {{- $serviceLinks := slice -}} {{- range . -}} {{- $serviceLinks =
(By signing up, you will get access to the following services: {{ range $index, $service $serviceLinks | append (printf `<a href="%s">%s</a>` .RelPermalink .LinkTitle) -}} {{- end
:= . }}{{ if $index }}, {{ end }}<a href="{{ $service.RelPermalink }}" -}}
>{{ $service.LinkTitle }}</a <div
>{{ end }}) id="auth-message"
</p> class="auth-message auth-message--info is-visible"
{{ end }} {{ end }} aria-live="polite"
>
Signing up is giving you access to the following services: {{ delimit $serviceLinks ", "
| safeHTML }}
</div>
{{- end -}} {{- if not $registrationServices -}}
<div id="auth-message" class="auth-message" aria-live="polite"></div> <div id="auth-message" class="auth-message" aria-live="polite"></div>
{{- end -}} {{- end -}}
<!-- ── STEP 1 — Account details ───────────────────────────────── --> <!-- ── STEP 1 — Account details ───────────────────────────────── -->
<form id="signup-form" class="auth-form" novalidate> <form id="signup-form" class="auth-form" novalidate>
@@ -228,12 +234,21 @@
var pwdInput = document.getElementById('signup-password'); var pwdInput = document.getElementById('signup-password');
var eyeBtn = signupForm.querySelector('.auth-form__eye'); var eyeBtn = signupForm.querySelector('.auth-form__eye');
// Snapshot the server-rendered services notice so we can restore it after errors
var _servicesHTML = msgBox.innerHTML;
var _servicesClass = msgBox.className;
// Pin the box height to whatever the services text renders at, so switching
// to a one-line error message never shrinks the box and causes layout shift.
msgBox.style.minHeight = msgBox.offsetHeight + 'px';
function showMsg(text, type) { function showMsg(text, type) {
msgBox.textContent = text; msgBox.textContent = text;
msgBox.className = 'auth-message auth-message--' + type + ' is-visible'; msgBox.className = 'auth-message auth-message--' + type + ' is-visible';
} }
function hideMsg() { function hideMsg() {
msgBox.className = 'auth-message'; msgBox.innerHTML = _servicesHTML;
msgBox.className = _servicesClass;
} }
function setLoading(btn, on) { function setLoading(btn, on) {

View File

@@ -1085,10 +1085,12 @@
/* ── Auth pages (login / signup) ───────────────────────────────────────── */ /* ── Auth pages (login / signup) ───────────────────────────────────────── */
.auth-page__services { .auth-page__services {
margin-top: 25px; margin-top: 0;
margin-bottom: -25px; margin-bottom: 0.75rem;
font-size: 0.78rem; font-size: 0.78rem;
line-height: 1.45; line-height: 1.45;
color: var(--foreground-color);
display: block;
} }
.services-group__title { .services-group__title {
@@ -1114,12 +1116,12 @@
background: var(--background-color); background: var(--background-color);
} }
/* Message banner — fixed height always reserved so the form never shifts */ /* Message banner — always in flow; min-height reserves space so the form never shifts */
.auth-message { .auth-message {
border-radius: 4px; border-radius: 4px;
font-size: 0.82rem; font-size: 0.82rem;
line-height: 1.3; line-height: 1.4;
height: 1.8rem; min-height: 1.8rem;
margin-bottom: 0.75rem; margin-bottom: 0.75rem;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid transparent; border: 1px solid transparent;
@@ -1127,10 +1129,7 @@
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
transition: opacity 0.15s ease; transition: opacity 0.15s ease;
overflow: hidden; padding: 0.25rem 0.7rem;
display: flex;
align-items: center;
padding: 0 0.7rem;
} }
.auth-message.is-visible { .auth-message.is-visible {
@@ -1138,6 +1137,12 @@
pointer-events: auto; pointer-events: auto;
} }
.auth-message--info {
background: transparent;
border-color: transparent;
color: var(--foreground-color);
}
.auth-message--error { .auth-message--error {
background: rgba(255, 61, 61, 0.1); background: rgba(255, 61, 61, 0.1);
border: 1px solid rgba(255, 61, 61, 0.4); border: 1px solid rgba(255, 61, 61, 0.4);