fix(login): the login column follows the page width so the headline wraps on iPhones (BUG-2236)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
@@ -30103,6 +30103,19 @@
|
||||
- 关联记录:BUG-2229(引入补写调用)、BUG-2151(确定性补全,不动)、BUG-2150、BUG-2230、BUG-1647、BUG-2234。
|
||||
- 修复版本:`claude/chat-followups-2234`(本地提交,待推送)。
|
||||
|
||||
## BUG-2236 | 手机登录页横向溢出:标题不换行跑出右边,邮箱框和按钮整体右移被截掉
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-23 / 2026-11-23。
|
||||
- 现象:负责人用 iPhone 上的 Chrome(WebKit 内核)打开 staging 登录页,标题「在星图与当下之间,找到此刻的方向」排成一行、跑出屏幕右边;邮箱输入框、「用邮箱继续」、「或」分隔线、「用密码登录」整体右移,右半截被切掉。
|
||||
- 触发条件:iOS 浏览器(WebKit),手机宽度。桌面和本地 Chromium 无头浏览器在 320–430 px 都复现不出来(标题正常换行、无横向滚动)。
|
||||
- 根因(据截图和样式推断,未在 WebKit 上直接复现):BUG-2139 的方向 A 版式里 `.auth-page`、`.auth-center`、`.auth-heading` 都是没写列宽的 grid(隐式 auto 列),标题和表单靠 `justify-items: center` 收缩到内容宽。WebKit 按标题一行的宽度定了这一列,于是标题不换行、整列比屏幕宽,`.auth-page` 的 `overflow-x: hidden` 把右边截掉,340 px 的表单在这一宽列里居中,看起来右移。
|
||||
- 修复:`globals.css` 三层都写成 `grid-template-columns: minmax(0, 1fr)`(`.auth-center` / `.auth-heading` 加 `width: 100%; min-width: 0`),列宽只跟页面走;标题 `width: 100%; min-width: 0; overflow-wrap: anywhere`,保留 `text-wrap: balance` 和居中;640 px 以下标题字号 `clamp(22px, 7vw, 28px)`。手机两侧留白仍是 `max(16px, 安全区)`。桌面版式不变。
|
||||
- 验证:`frontend/tests/login-mobile-overflow-2236.test.ts`(三层列宽、标题可换行、手机留白);`login-direction-a-2139.test.tsx` 照常通过;本地构建 + 无头 Chrome 在 390×844、320×640、430×932、1280×800 下浅色 / 深色的邮箱、验证码、密码三屏量过:`scrollWidth == innerWidth`,标题和表单都在左右 16 px 留白之内。WebKit 真机待负责人在 staging 上复看。
|
||||
- 防复发:上面的样式合同测试。
|
||||
- 关联记录:BUG-2139(方向 A 登录页)。
|
||||
- 修复版本:`claude/login-mobile-2236`(本地提交,待推送)。
|
||||
|
||||
## BUG-2237 | 建档第 2 屏:选「大概记得」后要把出生时间再填一遍,还有时辰格和三个追问,没填完不能继续
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
|
||||
@@ -2674,19 +2674,22 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class
|
||||
/* Login, direction A (owner 2026-11-22, BUG-2139 step 2): one centred column on the page
|
||||
canvas. Brand in the top row, headline and form in the middle row, the legal footer
|
||||
in the bottom row (BUG-1122: the footer takes its own row, never pushes the form up). */
|
||||
.auth-page { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 0 var(--space-8); background: var(--color-canvas); }
|
||||
/* BUG-2236: the one column is pinned to the page width (minmax(0, 1fr)), never sized from
|
||||
the headline's single-line width. iOS browsers (WebKit) sized the implicit auto column
|
||||
from that width: the headline ran off the right edge and the form sat off-centre. */
|
||||
.auth-page { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; padding: 0 var(--space-8); background: var(--color-canvas); }
|
||||
.auth-page > .auth-brand { grid-row: 1; }
|
||||
.auth-page > .auth-center { grid-row: 2; }
|
||||
.auth-page > .auth-legal-footer { grid-row: 3; align-self: end; }
|
||||
.auth-brand { display: flex; align-items: center; gap: var(--space-3); min-height: 72px; font-family: var(--font-display); font-size: var(--type-title-lg); }
|
||||
.auth-brand strong { font-weight: 400; }
|
||||
.auth-center { min-width: 0; display: grid; justify-items: center; align-content: center; gap: var(--space-6); padding: var(--space-8) 0 var(--space-12); text-align: center; }
|
||||
.auth-center { min-width: 0; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: center; gap: var(--space-6); padding: var(--space-8) 0 var(--space-12); text-align: center; }
|
||||
.auth-body { width: min(340px, 100%); display: grid; gap: var(--space-4); text-align: left; }
|
||||
.auth-heading { display: grid; justify-items: center; gap: var(--space-3); }
|
||||
.auth-heading { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--space-3); }
|
||||
.auth-intro { max-width: 340px; margin: 0; color: var(--color-ink-secondary); font-size: var(--type-body-sm); line-height: 1.6; text-wrap: pretty; }
|
||||
/* The headline is in the server HTML. With motion allowed it waits hidden (at its final
|
||||
size) for up to 2 s while the script loads, then types out; past 2 s it simply shows. */
|
||||
.auth-headline { max-width: 100%; margin: 0; color: var(--color-ink); font-family: var(--font-display); font-size: clamp(28px, 3vw, 36px); font-weight: 500; letter-spacing: -.5px; line-height: 1.3; text-wrap: balance; }
|
||||
.auth-headline { width: 100%; max-width: 100%; min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--color-ink); font-family: var(--font-display); font-size: clamp(28px, 3vw, 36px); font-weight: 500; letter-spacing: -.5px; line-height: 1.3; text-wrap: balance; }
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.auth-headline[data-typing="wait"] .auth-headline-text { visibility: hidden; animation: auth-headline-show 0s linear 2s forwards; }
|
||||
}
|
||||
@@ -2887,6 +2890,7 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class
|
||||
/* Phones wrap the headline on their own instead of after the comma. */
|
||||
@media (max-width: 640px) {
|
||||
.auth-headline-break { display: none; }
|
||||
.auth-headline { font-size: clamp(22px, 7vw, 28px); }
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
|
||||
// BUG-2236: on an iPhone (WebKit) the login column was sized from the headline's
|
||||
// one-line width, so the headline ran off the right edge and the form sat off-centre.
|
||||
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
||||
const rule = (selector: string) => {
|
||||
const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const found = css.match(new RegExp(`(?:^|\\n)${escaped} \\{([^}]*)\\}`));
|
||||
assert.ok(found, `missing rule ${selector}`);
|
||||
return found[1];
|
||||
};
|
||||
|
||||
test("every login column is pinned to the page width, never to the headline's width", () => {
|
||||
for (const selector of [".auth-page", ".auth-center", ".auth-heading"]) {
|
||||
assert.match(rule(selector), /grid-template-columns: minmax\(0, 1fr\)/, `${selector} needs a minmax(0, 1fr) column`);
|
||||
}
|
||||
assert.match(rule(".auth-center"), /min-width: 0; width: 100%/);
|
||||
assert.match(rule(".auth-heading"), /width: 100%; min-width: 0/);
|
||||
});
|
||||
|
||||
test("the headline always wraps inside the column", () => {
|
||||
const headline = rule(".auth-headline");
|
||||
assert.match(headline, /width: 100%; max-width: 100%; min-width: 0/);
|
||||
assert.match(headline, /overflow-wrap: anywhere/);
|
||||
assert.match(headline, /text-wrap: balance/);
|
||||
assert.doesNotMatch(headline, /white-space: nowrap|word-break: keep-all|min-width: (?!0)/);
|
||||
assert.match(css, /@media \(max-width: 640px\) \{\s*\.auth-headline-break \{ display: none; \}\s*\.auth-headline \{ font-size: clamp\(22px, 7vw, 28px\); \}/);
|
||||
});
|
||||
|
||||
test("phones keep at least 16px side gutters plus the safe area", () => {
|
||||
assert.match(css, /\.auth-page \{ overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 0 max\(var\(--space-4\), env\(safe-area-inset-right\)\) 0 max\(var\(--space-4\), env\(safe-area-inset-left\)\); \}/);
|
||||
assert.match(rule(".auth-body"), /width: min\(340px, 100%\)/);
|
||||
});
|
||||
@@ -20,7 +20,10 @@ test("mobile login can scroll and keeps the form reachable on a short screen", (
|
||||
assert.match(css, /\.standalone-page \{ width: 100%; height: 100vh; overflow: auto; \}/);
|
||||
assert.match(css, /@supports \(height: 1dvh\) \{[^}]*\.standalone-page \{ height: 100dvh; \}/);
|
||||
assert.match(css, /@media \(max-width: 767px\) \{[\s\S]*?\.auth-page \{ overflow-x: hidden; -webkit-overflow-scrolling: touch;/);
|
||||
assert.match(css, /\.auth-page \{ display: grid; grid-template-rows: auto minmax\(0, 1fr\) auto;/);
|
||||
// 原值:`.auth-page { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; …`
|
||||
// 新值:`.auth-page { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; …`
|
||||
// 原因:BUG-2236,iPhone 上隐式 auto 列按标题一行的宽度撑开,整列比屏幕宽;列宽改为跟页面走
|
||||
assert.match(css, /\.auth-page \{ display: grid; grid-template-columns: minmax\(0, 1fr\); grid-template-rows: auto minmax\(0, 1fr\) auto;/);
|
||||
assert.doesNotMatch(css, /\.auth-shell|\.auth-story/);
|
||||
assert.match(layout, /interactiveWidget:\s*"resizes-content"/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user