fix(login): the tab bar no longer covers the heading in the password tab; 返回登录 sits clear of the email label (BUG-2139)
Independent Staging Quality Gate / validate-python (push) Successful in 10m5s
Independent Staging Quality Gate / validate-frontend (push) Successful in 13m35s
Independent Staging Quality Gate / publish (push) Successful in 3m24s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
This commit is contained in:
2026-11-22 00:36:12 +08:00
co-authored by Claude Opus 5.5
parent a228426438
commit f36ce99ada
3 changed files with 76 additions and 1 deletions
+12
View File
@@ -28890,3 +28890,15 @@
- 验证与防复发:`tests/test_report_place_label_2135.py`(中文地名连写无「·」、国外地名空格分隔);`tests/test_report_fields_2065b.py` 的地点标签测试照过。
- 关联记录:BUG-2065,`annual-page-export-dot` 替换表(2026-11-13)。
- 修复版本:`claude/birth-coordinates-2125`。
## BUG-2139 | 登录页「密码登录」时标题「登录或注册」下半截被页签盖住;登录页多余的提示句
- 状态:fixed-pending-verify(第一步:遮挡与提示句;登录页按方向 A 改版另行跟进)。
- 首次发现 / 最近更新:2026-11-21 / 2026-11-22。
- 触发与现象:负责人在平板(深色)打开登录页、切到「密码登录」,标题「登录或注册」只露出下半截,紧贴在「验证码登录 / 密码登录」页签上方;「返回登录」链接贴在「邮箱」标签上像是输入框的一部分;左栏底部「对话只有你能看到,换台设备也能接着聊」负责人认为是过度提示。
- 触发条件:登录页切到密码登录(所有宽度、浅色和深色都一样,重叠恰好 16px);注册账号、忘记密码两种状态的「返回登录」。
- 根因:`.auth-mode-nav` 用 `margin-top: calc(var(--space-4) * -1)` 抵消上方说明段 `.page-intro` 的下边距;BUG-1662/1663/1664/1670(8ae116d30,2026-11-06)让密码登录不再显示说明段后,页签直接接在标题下面,负的上边距把不透明的页签拉上去盖住标题下方 16px。
- 修复:`.auth-mode-nav` 的上边距改为正值,只有紧跟说明段时(`.page-intro + .auth-mode-nav`)才抵消,验证码登录的间距一像素不变;「返回登录」下方加 16px;删除左栏底部那句提示及其样式。
- 验证与防复发:`frontend/tests/login-heading-clip-20261121.test.ts`(密码登录没有说明段时页签跟在标题后、基础规则不得是负上边距、返回登录间距);本地生产构建 7 种宽度 × 浅深色 × 四种登录状态的改前改后截图对比。教训:不要用负边距去抵消一个有时不渲染的元素的边距。
- 关联记录:BUG-1662、BUG-1663、BUG-1664、BUG-1670。
- 修复版本:`claude/birth-coordinates-2125`。
+6 -1
View File
@@ -2695,7 +2695,10 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class
.stack-form .button-primary { margin-top: var(--space-2); }
.otp-input { text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: .35em; font-family: var(--font-mono); }
.inline-actions button { min-height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; color: var(--color-action); font-size: 13px; }
.auth-mode-nav { display: grid; gap: var(--space-3); margin: calc(var(--space-4) * -1) 0 var(--space-6); }
/* The tabs sit 16px under whatever is above them. Only the intro line carries a 32px bottom margin to take back;
密码登录 has no intro, and a negative top margin there pulled the tabs over the heading. */
.auth-mode-nav { display: grid; gap: var(--space-3); margin: var(--space-4) 0 var(--space-6); }
.page-intro + .auth-mode-nav { margin-top: calc(var(--space-4) * -1); }
/* Full-width segmented control: the list owns the height, the tabs fill it (no tab hanging below the track). */
.auth-mode-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; width: 100%; height: 44px; padding: 3px; border-radius: var(--radius-md); background: var(--color-canvas-muted); }
.auth-mode-tabs button { height: 100%; min-width: 0; min-height: 0; border: 1px solid transparent; border-radius: calc(var(--radius-md) - 3px); background: transparent; box-shadow: none; cursor: pointer; color: var(--color-ink-secondary); font: inherit; font-size: 16px; transition: background-color 160ms ease-out, color 160ms ease-out; }
@@ -2706,6 +2709,8 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class
.auth-code-group { width: 100%; }
.auth-code-slot { flex: 1 1 0; height: 48px; width: auto; border-color: var(--color-border); background: transparent; color: var(--color-ink); font-family: var(--font-mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); }
/* 返回登录 is page navigation, not part of the email field below it. */
.auth-panel > .auth-links { margin-bottom: var(--space-4); }
.auth-links button { position: relative; min-height: 32px; padding: 0; color: var(--color-action); }
/* Visual link stays 32px; wrap gap is 8px, so a 44px overlay would overlap. */
.auth-links button::after {
@@ -0,0 +1,58 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
import { cssDeclarations } from "./css-contract-test-support.ts";
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
const login = readFileSync(new URL("../src/components/email-otp-login.tsx", import.meta.url), "utf8");
/** Every rule whose selector ends on `.auth-mode-nav`, with the selector that owns it. */
function authModeNavRules() {
const withoutComments = css.replace(/\/\*[\s\S]*?\*\//g, " ");
const rules: { selector: string; body: string }[] = [];
for (const [, selectorList, body] of withoutComments.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
for (const raw of selectorList.split(",")) {
const selector = raw.trim().replace(/\s+/g, " ");
if (/\.auth-mode-nav$/.test(selector)) rules.push({ selector, body: body.trim() });
}
}
return rules;
}
function marginTop(body: string): string | null {
const longhand = body.match(/margin-top:\s*([^;]+)/);
if (longhand) return longhand[1].trim();
const shorthand = body.match(/(?:^|[;\s])margin:\s*([^;]+)/);
if (!shorthand) return null;
// First token of the shorthand is the top margin; calc(...) counts as one token.
return shorthand[1].trim().match(/^(calc\((?:[^()]|\([^()]*\))*\)|\S+)/)?.[1] ?? null;
}
test("password login has no intro line, so the tabs follow the heading directly", () => {
// The trigger: 密码登录 sets intro to "" and the <p class="page-intro"> is not rendered.
assert.match(login, /mode === "password"\s*\?\s*""/);
assert.match(login, /\{intro \? <p className="page-intro">\{intro\}<\/p> : null\}/);
assert.match(login, /<h1 id="login-title">\{title\}<\/h1>[\s\S]*?<nav className="auth-mode-nav"/);
});
test("the login tabs never pull up over the heading (owner 2026-11-21: 「登录或注册」 cut in half)", () => {
const rules = authModeNavRules();
const base = rules.find((rule) => rule.selector === ".auth-mode-nav");
assert.ok(base, "missing .auth-mode-nav rule");
const baseTop = marginTop(base.body);
assert.ok(baseTop, ".auth-mode-nav must declare its top margin");
assert.doesNotMatch(baseTop, /^-|\*\s*-1|-1\s*\*/, `base .auth-mode-nav top margin is negative: ${baseTop}`);
assert.equal(baseTop, "var(--space-4)");
// A negative top margin is only allowed right after the intro line, whose own 32px bottom margin it takes back.
for (const rule of rules) {
const top = marginTop(rule.body);
if (!top || !/^-|\*\s*-1|-1\s*\*/.test(top)) continue;
assert.equal(rule.selector, ".page-intro + .auth-mode-nav", `negative top margin on ${rule.selector}`);
}
assert.match(cssDeclarations(".page-intro", css), /margin:\s*var\(--space-3\) 0 var\(--space-8\)/);
});
test("返回登录 keeps a gap above the email label instead of sitting on it", () => {
assert.match(cssDeclarations(".auth-panel > .auth-links", css), /margin-bottom:\s*var\(--space-4\)/);
});