Skip to content

fix(web): 手机端侧栏长标题不再被 iPhone 自动放大 / stop iPhone text autosizing from enlarging sidebar titles - #1346

Merged
iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
sduhantao-maker:fix/web-phone-title-autosizing
Nov 28, 2026
Merged

iruriQ merged 1 commit into
BytePioneer-AI:mainfrom
sduhantao-maker:fix/web-phone-title-autosizing

Conversation

@sduhantao-maker

Copy link
Copy Markdown
Contributor

摘要

手机 Web 的侧栏抽屉里,收起的父会话(带「N 个子会话」小结的行)标题比相邻行大一号。手机端搜索结果里的长标题也一样。原问题来自实机 iPhone。

原因:

  • 带右侧渐隐的标题(项目、会话、搜索结果)把 .titleText 按 max-content 宽度排版,长标题的文字盒子比手机屏幕宽。
  • iPhone 上的 WebKit 使用旧版文字自动放大(小屏设备上 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 类名)。

行 修复前 修复后
收起的父会话(4 行,标题盒子 702–1111px) 20px 14px
搜索结果长标题(8 行,盒子 753–1162px) 21px 14px
搜索结果短标题(4 行,盒子不超过 397px) 14px 14px
普通会话行(11 行,其中一行盒子 671px) 14px 14px
「N 个子会话」小结 11px 11px
  • 改动文件的 prettier --check(3.9.6,pre-commit 钩子)通过。
  • 按 AGENTS.md,Web 页面不写组件测试。
  • 未测试:用本分支构建的 Web 包(验证用的是在 0.28.2 页面中注入的等价 CSS);实体 iPhone、iPad、Android。

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:

  • Titles with the right-edge fade (projects, Threads, search results) lay out .titleText at max-content width, so a long title's text box is wider than a phone screen.
  • WebKit on iPhone uses legacy text autosizing (defaultTextAutosizingUsesIdempotentMode() returns false on small screens). RenderBlockFlow::adjustFontSizes enlarges text in blocks wider than the visible width, and RenderElement::adjustFontSizesOnBlocks skips subtrees with a fixed height.
  • A regular Thread row keeps its title inside .sessionMain, whose height: var(--dsh-thread-row-height) (44px in the phone drawer) blocks the enlargement.
  • A collapsed parent Thread in the phone drawer switches to a two-row grid and sets .sessionMain to display: contents, which generates no box, so that protection is gone. Search result rows only have a min-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:

  • Add -webkit-text-size-adjust: 100% and text-size-adjust: 100% to the rule shared by the three faded title kinds in Rows.module.css.
  • 100% only turns off autosizing and keeps browser zoom. The phone diff in TurnChangesCard.module.css already uses the same declarations, and the 0.28.2 build output keeps both of them.
  • Desktop browsers do no such autosizing, so they look the same.

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.

Row Before After
Collapsed parent Thread (4 rows, title boxes 702–1111px) 20px 14px
Long search result title (8 rows, boxes 753–1162px) 21px 14px
Short search result title (4 rows, boxes up to 397px) 14px 14px
Regular Thread row (11 rows, one box 671px) 14px 14px
"N child sessions" summary 11px 11px
  • prettier --check (3.9.6, pre-commit hook) passes on the changed file.
  • Per AGENTS.md, no component tests for Web pages.
  • Not tested: a Web bundle built from this branch (verification used the equivalent CSS injected into the 0.28.2 page); a real iPhone, iPad and Android.

UI Demo

Before: the collapsed parent Thread title is larger than its neighbors; after: it matches them

Before: long search result titles are enlarged; after: they match the short titles

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.

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.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 问题修复
    • 修正标题、搜索结果及折叠的手机 Thread 行中文字尺寸可能被浏览器自动调整的问题。
    • 浏览器缩放和用户字体偏好仍可正常使用。

相关文本容器新增文本尺寸规则,将文字尺寸设为 100%,避免浏览器自动调整文字尺寸。

Changes: 行文本尺寸调整

Layer / File(s) Summary
添加文本尺寸规则
apps/web-ui/packages/client/ui-workspace/src/client/rows/Rows.module.css
标题文本容器新增 -webkit-text-size-adjust: 100% 和 text-size-adjust: 100%。

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to fa6cf

This adds a CSS rule that stops iPhone Safari from enlarging long sidebar and search-result titles. It is low-risk and easy to revert, and no concrete defects were found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(web): 手机端侧栏长标题不再被 iPhone 自动放大”准确描述了主要改动:在 Rows.module.css 的渐隐标题规则上添加 text-size-adjust: 100%,阻止 iPhone 自动放大侧栏长标题。标题与变更集相符,包含 fix 类型前缀和作用范围。
Description check Passed 描述详细说明了问题现象(收起的父会话和搜索结果长标题被 iPhone 放大)、根本原因(max-content 宽度与 WebKit 旧版文字自动放大)、具体改动(Rows.module.css 中添加两条声明)、测试环境与结果表格,以及未测试项。与变更集高度相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between cfc33ca and fa6cfdc.

Files selected for processing: 1

  • apps/web-ui/packages/client/ui-workspace/src/client/rows/Rows.module.css

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Web Host tests
  • GitHub Check: Vitest
  • GitHub Check: Check macos-26
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Check windows-latest
  • GitHub Check: Static checks
Additional context used

Code guidelines: 1

docs/product/standalone-web.md — auto-discovered
Path-based instructions: 1

Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.

CodeRabbit inference engine (docs/product/standalone-web.md)

Files:

  • apps/web-ui/packages/client/ui-workspace/src/client/rows/Rows.module.css
Additional comments: 1

apps/web-ui/packages/client/ui-workspace/src/client/rows/Rows.module.css: 1

620-620: Functional Correctness

本评论的前提不成立。折叠的手机 Thread 行位于 css.sessionRow 元素内部,因此 .sessionRow .title 会匹配标题。搜索结果标题则由同一选择器列表中的 .searchResultTitle 直接匹配。该规则中的 -webkit-text-size-adjust 与 text-size-adjust 声明没有被其他规则覆盖。因此,未发现需要修改的问题。

@sduhantao-maker

Copy link
Copy Markdown
Contributor Author

CI 说明:本 PR 只改了 Rows.module.css。失败的两项与 main(cfc33ca86)的 CI 运行 46109839755 失败内容完全一致,不是本 PR 引入的。

  • Static checks:prettier --check . 报 apps/web-ui/packages/client/ui-sidebar/src/client/SidebarRoot.tsx。main 上 5861284 留下第 404 行未格式化。
  • Vitest:packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.ts 的 6 个用例失败,报 TypeError: node.matches is not a function。原因是 9898485 在 renderer-binding-probe.ts:776 新增的 isDelegationMentionMutationNode 会调用 matches(),而测试里的 FakeElement 没有这个方法。失败用例列表与 main 相同。
  • 其余检查通过:Check Linux ARM64、Check ubuntu-22.04、Check macos-26、Check windows-latest、Web Host tests、CodeRabbit。

CI note: this PR only changes Rows.module.css. The two failing checks match the failures of main's CI run 46109839755 (cfc33ca) exactly and are not introduced by this PR.

  • Static checks: prettier --check . flags apps/web-ui/packages/client/ui-sidebar/src/client/SidebarRoot.tsx. Commit 5861284 on main left line 404 unformatted.
  • Vitest: 6 cases in packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.ts fail with TypeError: node.matches is not a function. Commit 9898485 added isDelegationMentionMutationNode in renderer-binding-probe.ts:776, which calls matches(), and the test's FakeElement has no such method. The failing list is the same as on main.
  • Other checks pass: Check Linux ARM64, Check ubuntu-22.04, Check macos-26, Check windows-latest, Web Host tests and CodeRabbit.

@iruriQ
iruriQ merged commit 6d7ade8 into BytePioneer-AI:main Nov 28, 2026
6 of 8 checks passed
@iruriQ

iruriQ commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献,已合并到 main!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants