Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): let the login screen scroll on short windows
Yudhi Armyndharis3787be3517c4
diff --git a/dashboard/src/pages/Login.css b/dashboard/src/pages/Login.cssindex fa83ee40a..51bcaa2fd 100644--- a/dashboard/src/pages/Login.css+++ b/dashboard/src/pages/Login.css@@ -4,7 +4,6 @@display: flex;flex-direction: column;align-items: center;- justify-content: center;background: var(--bg-light);padding: 2rem;position: fixed;@@ -12,8 +11,11 @@left: 0;right: 0;bottom: 0;+ overflow-y: auto;}+/* The card and the footer centre as one group with auto margins, not justify-content: when the window is+ shorter than the group the margins give way and the container scrolls from its top edge. */.login-container .login-card {background: var(--bg-white);border-radius: 12px;@@ -22,6 +24,7 @@width: 100%;max-width: 420px;text-align: center;+ margin-top: auto;}.login-container .login-logo {@@ -177,6 +180,7 @@.login-container .login-footer {margin-top: 2rem;+ margin-bottom: auto;display: flex;flex-direction: column;align-items: center;diff --git a/dashboard/src/pages/Login.responsive.test.ts b/dashboard/src/pages/Login.responsive.test.tsnew file mode 100644index 000000000..6fad905af--- /dev/null+++ b/dashboard/src/pages/Login.responsive.test.ts@@ -0,0 +1,20 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { decl, readRules } from '../test-helpers/css-rules.ts';++// The login screen is position: fixed, so it never extends the page. On a window shorter than the card (a phone+// in landscape, a page zoomed to 200 percent) the logo and the footer link were cut off with nothing to scroll.+// Centring with justify-content cuts both ends of an overflowing column equally, and scrolling cannot reach the+// part above the top edge, so the card and the footer centre themselves with auto margins instead.+const rules = readRules(new URL('./Login.css', import.meta.url));+const body = (selector: string): string => rules.find(r => !r.media && r.selectors.includes(selector))?.body ?? '';++test('the login container scrolls when the window is shorter than its content', () => {+ assert.equal(decl(body('.login-container'), 'overflow-y'), 'auto');+});++test('the login content centres with auto margins, which give way to scrolling', () => {+ assert.equal(decl(body('.login-container'), 'justify-content'), undefined);+ assert.equal(decl(body('.login-container .login-card'), 'margin-top'), 'auto');+ assert.equal(decl(body('.login-container .login-footer'), 'margin-bottom'), 'auto');+});