diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 551a8e6c..94ef5272 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -14578,6 +14578,21 @@ - 复发自:无 - 修复版本:`codex/self-edit-avatar-menu-20260928` 第 4 个提交 +## BUG-1083 | 手机上星盘页被撑出屏幕,北印度盘右侧与下方被裁掉 + +- 状态:resolved(CSS 修复 + 回归测试 + 无头 Chrome 390×844 修复前后实测;真机待部署后按 `docs/testing/mobile-chart-confirmed-edit-20260929.md` 复核) +- 首次发现 / 最近更新:2026-09-29 / 2026-09-29 +- 影响面:`/chart`「星盘」Tab 下全部盘型(本命、D9、月亮、Bhava、D10 实测);桌面 1280 宽下右侧也被裁(参数卡被切、「≡」盘型按钮看不到)。大运 / 基础信息 / 西洋盘三个 Tab 在 390 宽下修复前就不溢出。 +- 用户现象:iPhone 上星盘页的北印度盘远大于屏幕,只能看到左上一块,盘下的参数表与行星表看不到;电脑上出生地一行在右边被截断。 +- 触发条件:任何视口宽度小于星盘页正文最小内容宽度(盘型条 23 个 chip 不折行 + `.chart-page-planet-table { min-width: 34rem }`)。 +- 根因:`.secondary-page` 是 `display: grid`,没有 `grid-template-columns`,隐式列是 `auto`;它的子项 `.chart-page-body` 保持默认 `min-width: auto`,于是这一列按正文的最小内容宽度定宽。无头 Chrome(CDP 模拟 390×844、真实组件 + golden 夹具 SSR + 构建产物 CSS)逐层量:`.secondary-page` 390px,`.chart-page-body` 1101px,其下 `.chart-page-panel` / `.chart-page-vedic` / `.chart-page-vedic-layout` / `.chart-page-vedic-stage` 1069px,盘面 SVG 1043px——第一个超宽的祖先是 `.chart-page-body`。内层 `.chart-page-planet-table-wrap`、`.chart-page-varga-table-block`、`.chart-page-type-strip` 各自的 `min-width: 0` 与横向滚动都在,但撑宽发生在它们之外的这一层。外层面板 `overflow-x: hidden` 把溢出直接裁掉而不是出现横向滚动条,所以页面看起来"只是很大"。 +- 修复:`.secondary-page` 加 `grid-template-columns: minmax(0, 1fr)`,让唯一一列可以小于内容宽度;宽内容继续在自己的盒子里横滚。修在四个次级页共用的这一层,而不是只给 `.chart-page-body` 补 `min-width: 0`,同一容器里的其他页面不再有同类风险。 +- 验证:修复后 390×844 下本命 / D9 / Bhava / 月亮 / D10 五张:`documentElement.scrollWidth` = 390,无任一祖先超宽,盘面 332px;1280×900 下两栏布局不变,盘面 549 → 480px、参数卡与「≡」完整可见。回归测试 `frontend/tests/chart-page-mobile-width-20260929.test.ts`(锁 `.secondary-page` 的 `minmax(0, 1fr)`,以及内层表格 / 盘型条的横向滚动)。截图见 `docs/tasks/PROGRESS-mobile-chart-confirmed-edit-20260929.md`。 +- 防复发:次级页里的新 grid / flex 容器沿用「子项可收缩」规则;验收星盘页类改动时在 390 宽下量 `scrollWidth` 与盘面宽度,不能只看桌面。 +- 相关记录:BUG-1076~1078(盘型条与八列行星表把最小内容宽度推大,是本次的放大因素) +- 复发自:无 +- 修复版本:`codex/mobile-chart-confirmed-edit-20260929` 第 1 个提交 + ## BUG-1084 | 生时校正开场后一路邀请补经历,补来的经历不收窄范围 - 状态:investigating(Claude 诊断 + 离线复现;修复见 `docs/tasks/TASK-rectification-futile-collect-stop-20260929.md` T1) diff --git a/frontend/DESIGN.md b/frontend/DESIGN.md index d53cc610..5b6e4dcc 100644 --- a/frontend/DESIGN.md +++ b/frontend/DESIGN.md @@ -485,7 +485,11 @@ one skeleton, none of them carrying the sidebar. share `SecondaryPageShell`: the same 46px `SecondaryHeader` (sidebar trigger, page name, a reserved note slot so a late birth line cannot collapse the row, up to two actions) and a `.secondary-page` body that always fills the - remaining viewport. Waiting copy is centered in that cell; swapping in the + remaining viewport. `.secondary-page` is a one-column grid whose column is + `minmax(0, 1fr)`: it may shrink below its content, so a nowrap strip or a + 34rem table scrolls inside its own box and never widens the page (BUG-1083 — + the implicit `auto` column let the chart page grow to 1101px on a 390px + phone and cut the chart off; desktop was clipped on the right too). Waiting copy is centered in that cell; swapping in the tall content does not change the shell height. No spinner or 「正在加载」; skeletons are limited to the chart-page plot positions (§15, 2026-09-24). First-screen data for the three pages lives in a module-level cache; a second visit paints the last result immediately and refreshes in @@ -1031,7 +1035,7 @@ D40 / D45 / D60 的表格上方,出生时间不是「已校正」时多一句 ### 行星表 -每一张 `.chart-page-planet-table`(本命、分盘、月亮盘、Bhava 两张、行运、西洋相位)都包在 `.chart-page-planet-table-wrap` 里:`min-width: 0` + `overflow-x: auto`。375px 下表格在自己的盒子里横滚,页面不横滚。`min-width: 0` 和 overflow 一样是必需的——grid item 默认按内容定宽,少了它表格会把页面撑宽而不是滚动。印度盘那张从四列扩到八列后 `min-width` 由 `26rem` 提到 `34rem`。 +每一张 `.chart-page-planet-table`(本命、分盘、月亮盘、Bhava 两张、行运、西洋相位)都包在 `.chart-page-planet-table-wrap` 里:`min-width: 0` + `overflow-x: auto`。375px 下表格在自己的盒子里横滚,页面不横滚。`min-width: 0` 和 overflow 一样是必需的——grid item 默认按内容定宽,少了它表格会把页面撑宽而不是滚动。外层 `.secondary-page` 的单列同理是 `minmax(0, 1fr)`(BUG-1083),否则撑宽发生在更外面一层。印度盘那张从四列扩到八列后 `min-width` 由 `26rem` 提到 `34rem`。 **印度盘行星表的八列(2026-09-18)。** 盘里不再写的东西全部落在这里: diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index 5837520c..2bb91c98 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -2209,6 +2209,12 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class } .secondary-page { display: grid; + /* One column that may shrink below its content (BUG-1083). The implicit + `auto` track took the page body's min-content — the nowrap chart-type strip + and the 34rem planet table — so on a phone the chart page grew past the + viewport and the North Indian chart was cut off on the right. Wide content + scrolls inside its own box instead. */ + grid-template-columns: minmax(0, 1fr); align-content: start; min-height: 0; } diff --git a/frontend/tests/chart-page-mobile-width-20260929.test.ts b/frontend/tests/chart-page-mobile-width-20260929.test.ts new file mode 100644 index 00000000..526b8968 --- /dev/null +++ b/frontend/tests/chart-page-mobile-width-20260929.test.ts @@ -0,0 +1,27 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import test from "node:test"; + +import { cssDeclarations } from "./css-contract-test-support.ts"; + +/* + * BUG-1083 (TASK-mobile-chart-and-confirmed-edit-20260929 M1): on an iPhone the + * chart page grew past the viewport and cut the North Indian chart off. + * `.secondary-page` is a grid; its implicit `auto` column took the page body's + * min-content (the nowrap chart-type strip, the 34rem planet table), so the + * body measured 1101px at a 390px viewport (headless Chrome, golden fixture). + * The one column must be allowed to shrink below its content. + */ +const globalStyles = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8"); + +test("the secondary page's single column may shrink below its content (BUG-1083)", () => { + const page = cssDeclarations(".secondary-page", globalStyles); + assert.match(page, /display:\s*grid/); + assert.match(page, /grid-template-columns:\s*minmax\(0,\s*1fr\)/); +}); + +test("wide chart-page content still scrolls inside its own box instead of widening the page", () => { + assert.match(cssDeclarations(".chart-page-planet-table-wrap", globalStyles), /overflow-x:\s*auto/); + assert.match(cssDeclarations(".chart-page-type-strip", globalStyles), /overflow-x:\s*auto/); + assert.match(cssDeclarations(".chart-page-planet-table", globalStyles), /min-width:\s*34rem/); +});