Repository navigation
fix(web): 手机端侧栏长标题不再被 iPhone 自动放大 / stop iPhone text autosizing from enlarging sidebar titles - #1346
Conversation
Sidebar titles lay out at max-content width for the overflow fade, so a long title is wider than a phone screen. iPhone Safari enlarges such text unless a fixed-height row contains it. Collapsed Thread rows in the phone drawer and search results have no such row, so their long titles rendered at 20-21px instead of 14px. Set text-size-adjust: 100% on the faded title boxes.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
CI 说明:本 PR 只改了
CI note: this PR only changes
|
|
感谢贡献,已合并到 main! |
摘要
手机 Web 的侧栏抽屉里,收起的父会话(带「N 个子会话」小结的行)标题比相邻行大一号。手机端搜索结果里的长标题也一样。原问题来自实机 iPhone。
原因:
.titleText按 max-content 宽度排版,长标题的文字盒子比手机屏幕宽。defaultTextAutosizingUsesIdempotentMode()返回 false)。RenderBlockFlow::adjustFontSizes放大比可视宽度更宽的块里的文字,RenderElement::adjustFontSizesOnBlocks跳过设置了固定height的子树。.sessionMain里,它的height: var(--dsh-thread-row-height)(手机抽屉中为 44px)挡住了放大。.sessionMain变成display: contents,不再生成盒子,这层保护就没了。搜索结果行只有min-height。所以 14px 的长标题被放大到 20–21px。「N 个子会话」小结受列宽限制,没有超出屏幕,不受影响。改动:
Rows.module.css中三类渐隐标题共用的规则上加-webkit-text-size-adjust: 100%和text-size-adjust: 100%。100%只关掉自动放大,不影响浏览器缩放。TurnChangesCard.module.css的手机端 diff 已用同样写法,0.28.2 的构建产物也保留了这两条声明。关联 Issue
无 / N/A
测试
环境:Xcode 27.2 的 iPhone 18 Pro Max 模拟器(iOS 27,视口宽 440 CSS px),连接本机已安装的 0.28.2 Web 和真实会话数据。本地代理在页面里注入脚本,打开抽屉、展开项目,读取每个标题的计算字号和文字盒子宽度。修复组额外注入与本 PR 相同的 CSS(套用 0.28.2 的 CSS Modules 类名)。
prettier --check(3.9.6,pre-commit 钩子)通过。UI Demo
截图来自上面的模拟器。标题、项目名和分区名已在页面里替换为占位文字。被放大的行使用超出屏幕宽度的长占位标题,与原标题一样。
Summary
In the phone Web sidebar drawer, the title of a collapsed parent Thread (a row with an "N child sessions" summary) renders larger than the rows around it. Long titles in phone search results do the same. The original report came from a real iPhone.
Cause:
.titleTextat max-content width, so a long title's text box is wider than a phone screen.defaultTextAutosizingUsesIdempotentMode()returns false on small screens).RenderBlockFlow::adjustFontSizesenlarges text in blocks wider than the visible width, andRenderElement::adjustFontSizesOnBlocksskips subtrees with a fixedheight..sessionMain, whoseheight: var(--dsh-thread-row-height)(44px in the phone drawer) blocks the enlargement..sessionMaintodisplay: contents, which generates no box, so that protection is gone. Search result rows only have amin-height. As a result, 14px long titles grow to 20–21px. The "N child sessions" summary is limited to its column width, stays narrower than the screen, and is not affected.Change:
-webkit-text-size-adjust: 100%andtext-size-adjust: 100%to the rule shared by the three faded title kinds inRows.module.css.100%only turns off autosizing and keeps browser zoom. The phone diff inTurnChangesCard.module.cssalready uses the same declarations, and the 0.28.2 build output keeps both of them.Related issues
N/A
Test plan
Environment: the iPhone 18 Pro Max simulator from Xcode 27.2 (iOS 27, 440 CSS px viewport), connected to the locally installed 0.28.2 Web with real Thread data. A local proxy injected a script that opened the drawer, expanded projects, and read each title's computed font size and text box width. The fixed run also injected the same CSS as this PR, mapped to the 0.28.2 CSS Modules class names.
prettier --check(3.9.6, pre-commit hook) passes on the changed file.UI Demo
Screenshots come from the simulator above. Titles, project names and section names were replaced with placeholder text in the page. Enlarged rows use long placeholder titles that are wider than the screen, like the original titles.