Repository navigation
fix: 补齐宿主级联下的表格跨列溢出回归夹具(#285) - #286
Merged
wang-kaopu merged 2 commits intoOct 11, 2026
Merged
wang-kaopu merged 2 commits into
wang-kaopu merged 2 commits into
Conversation
宿主外壳把消息正文渲染在 `.markdown` 子树里,该表的两条规则会落在 `dsh-ui` 的输出上:`overflow-wrap: anywhere` 被单元格继承, `:not(pre) > code` 又把每个 chip 变成原子 `inline-flex` 盒。chip 自身的 `pre-wrap` 叠加这两条,会让 chip 的自动最小尺寸塌缩,列宽于是可以被算到 内容之下,而绘制时单元格的 `nowrap` 又让文字不断行 —— 文字就压到了下一列。 原有夹具在没有这层级联的页面上渲染表格,因此跨列重叠断言恒真。 - 表格 tfoot 单元格中的行内代码沿用「表格内 chip 不重新开启断行」规则 - 浏览器夹具补上宿主 `.markdown` 级联,让跨列溢出可在夹具中复现 - 重叠检查从首列相邻对扩展到所有相邻列对,并新增单元格自溢出断言 - 同步更新样式契约用例与检查数量
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #285(背景、根因链与真实页面实测数据都在 issue 里)
这个 PR 做什么
补上宿主级联下的跨列溢出回归夹具,并把表格内 chip 的覆盖范围补齐到
tfoot。为什么需要它
宿主外壳把消息正文渲染在
.markdown子树里,该表的两条规则会落在dsh-ui的输出上:.markdown { overflow-wrap: anywhere }—— 被每个表格单元格继承;.markdown :not(pre) > code { display: inline-flex }—— 把每个 chip 变成原子 inline-flex 盒。chip 自身的
white-space: pre-wrap叠加这两条之后,chip 的自动最小尺寸塌缩,列的 min-content 因此远小于内容宽度;而绘制时单元格的nowrap又让文字不断行,文字就压到了下一列(#280)。原有浏览器夹具在没有这层级联的页面上渲染表格,后果是:
adjacent-column overlap与horizontal scrolling两条几何断言恒真 —— 把 fix: 修复表格行内代码列溢出(#280) #282 的规则整块删掉重跑,它们仍然通过,只有「chip 的white-space必须是pre」这条契约断言会失败。也就是说,之前的回归保护落在实现细节上,而不是用户看得见的几何结果上。
改动
tests/browser/text-newlines.tsx、tests/browser/text-newlines.html:新增宿主级联用例(801px 容器 +.host-markdown包装),夹具内注入两条真实宿主规则;重叠检查从「col 0 → col 1」扩展到所有相邻列对,并新增「文字不得离开自己的单元格」与「表格内 chip 保持单行 whitespace」两条断言。scripts/check-text-newlines-browser.mjs:检查数量 118 → 124。src/client/GenuiBlock.module.css:tfoot纳入 chip 覆盖选择器,并补注释说明这层级联的来历。tests/genui-table-multiline-cell.spec.tsx:同步样式契约用例。CHANGELOG.md:Unreleased 补一条记录。验证
npx tsc -p tsconfig.json --noEmitnpx vitest runscripts/check-text-newlines-browser.mjs(保留现有修复)text crosses a column edgeoverPx=227、text leaves its own celloverPx=239最后一行正是这个 PR 的意义:夹具现在真的能拦住它,删掉修复就会红。
另外在运行中的 DSH 桌面端页面上做过实测(数据在 issue #285):0.11.4 下 7 张表格中 4 张溢出、单格最大 704px;只把表格内 chip 改为
white-space: pre(即 #282 的做法)后 0 溢出;移除注入还原现场后 704px 复现。