Skip to content

Commit d95004f

Browse files
authored
Header: every control in the phone row is the same size (#76)
On phones Settings was 42x44 while Install was 34x35 and the menu 38x33: the only sizing rule matched .icon-ctl inside .header-quick, which Install does not carry and the menu sits outside. One --hdr-ctl size now applies to the logo, the pass select and the three buttons: 44px from 360px up, shrinking below so MAX SENIOR still fits beside the select's arrow. npm run verify now fails when those controls differ by more than 1px at 360 and 390px.
1 parent 63b5fe1 commit d95004f

2 files changed

Lines changed: 40 additions & 5 deletions

File tree

‎scripts/verify-render.mjs‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*
44
* Serves ./dist and loads it in headless Chromium (home + a deep-link). Fails
55
* (exit 1) if #app stays effectively empty or any uncaught page error fires, so
6-
* a build that would show a blank page can never reach production.
6+
* a build that would show a blank page can never reach production. It also
7+
* fails when the controls in the phone header row differ in size.
78
*
89
* npm run build && npm run verify
910
*/
@@ -76,6 +77,31 @@ for (const { name, url } of pages) {
7677
await page.close();
7778
}
7879

80+
// Phone header: every visible control in the one-line row shares one height, and
81+
// every control but the pass select shares one width.
82+
const phone = await browser.newPage();
83+
for (const width of [360, 390]) {
84+
// Only a change of isMobile/hasTouch reloads the page; a width change reflows it.
85+
await phone.setViewport({ width, height: 844, isMobile: true, hasTouch: true });
86+
if (width === 360) {
87+
await phone.goto(BASE, { waitUntil: "load", timeout: 45000 });
88+
await phone.waitForSelector(".header-quick select");
89+
}
90+
const ctls = await phone.evaluate(() =>
91+
[...document.querySelectorAll(".site-header .logo, .header-quick > *, .header-nav > .menu-btn")]
92+
.map((e) => ({ e, r: e.getBoundingClientRect() }))
93+
.filter(({ r }) => r.width > 0 && r.height > 0)
94+
.map(({ e, r }) => ({ name: e.className || e.tagName, select: e.tagName === "SELECT", w: r.width, h: r.height })),
95+
);
96+
const spread = (xs) => Math.max(...xs) - Math.min(...xs);
97+
const icons = ctls.filter((c) => !c.select);
98+
const sizes = ctls.map((c) => `${c.name} ${c.w.toFixed(1)}x${c.h.toFixed(1)}`).join(", ");
99+
if (spread(ctls.map((c) => c.h)) > 1) failures.push(`[header ${width}px] control heights differ: ${sizes}`);
100+
if (spread(icons.map((c) => c.w)) > 1) failures.push(`[header ${width}px] icon button widths differ: ${sizes}`);
101+
console.log(` header ${width}px: ${sizes}`);
102+
}
103+
await phone.close();
104+
79105
await browser.close();
80106
server.close();
81107

‎src/styles.css‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4366,6 +4366,9 @@ select.input::-ms-expand {
43664366
.site-header {
43674367
flex-wrap: nowrap;
43684368
gap: 0.5rem;
4369+
/* One square size for the row. 184px is 53px of padding and gaps plus the
4370+
131px that fits "MAX SENIOR"; below 360px the squares shrink instead. */
4371+
--hdr-ctl: clamp(34px, (100vw - 184px) / 4, 44px);
43694372
}
43704373
.brand-badge {
43714374
display: none;
@@ -4392,13 +4395,19 @@ select.input::-ms-expand {
43924395
.header-quick select.ctl {
43934396
flex: 1;
43944397
min-width: 0;
4395-
min-height: 44px;
4398+
height: var(--hdr-ctl);
43964399
font-size: 0.95rem;
43974400
font-weight: 600;
43984401
}
4399-
.header-quick .icon-ctl {
4400-
width: 42px;
4401-
min-height: 44px;
4402+
/* Install carries no .icon-ctl and the menu sits outside .header-quick, so
4403+
each is named here beside Settings. */
4404+
.site-header .logo,
4405+
.header-quick .icon-ctl,
4406+
.header-quick .install-btn,
4407+
.header-nav > .menu-btn {
4408+
width: var(--hdr-ctl);
4409+
height: var(--hdr-ctl);
4410+
padding: 0;
44024411
flex: none;
44034412
}
44044413
.header-quick .install-label {

0 commit comments

Comments
 (0)