Repository navigation
fix(shell): 页签在固定上限模型上补同比例收缩(变窄时全部页签一起缩小) - #1972
Merged
Merged
Conversation
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.
变更概述
在现有「固定上限」页签模型上,补上维护者要求的行为:窗格变窄时所有页签名字一起同比例缩小、不被挤掉/覆盖。
原实现用
min-width: calc-size(max-content, min(96px, size))给长名页签保底 96px:变窄时长名缩到 96 即停、随后横向滚动,短名(保底=内容宽)不缩——不是「一起同比例缩」。且calc-size()仅 Chrome/Edge 支持、WebKit/WKWebView 不支持。本 PR 移除该
calc-size保底(改为min-width:0,由min-w-0提供),保留flex: 0 1 auto+max-width: var(--tab-max-width):max-width内以省略号收尾;flex-shrink:1让全部页签按同一比例连续收缩到适应可用宽度;calc-size)。关联 Issue
Closes #1843
变更内容
src/components/TabBar.tsx:删除minWidth: calc-size(...);保留maxWidth: var(--tab-max-width);flex-[0_1_auto]+min-w-0不变。openspec/specs/{navigation,application-shell}、docs/design/system/spec.md §7.5、decisions.md:口径改为「不伸展 + 固定上限 + 短名实际 + 长名省略号 + 变窄时同比例收缩(min-width:0,无 96 保底截断)」。e2e/tab-selection.spec.ts:ARTIFACT_DIR → .artifacts/1843;「保底截断+横向滚动」用例改写为「变窄时全部页签同比例收缩、无溢出」;保留长名省略号/上限、短名窄于长名、不铺满、间距 32px 断言。.artifacts/1843/state-coverage.json:4 态证据(长名上限+省略号、短名实际、不铺满、变窄同比例收缩)。实测(8 个等长长标题页签)
scrollWidth 538 ≤ clientWidth 538(收缩到适应,无溢出/无横向滚动)。验证方式
tab-selection.spec.ts+tab-strip-dblclick.spec.ts12 passed。.artifacts/1843/state-coverage.json(4 态 passed)。质量门禁引用
calc-size保底与「同比例」冲突且 WebKit 不支持,故移除。风险评估
风险等级: medium(用户可见布局 + 规格口径调整)
来源: ai-generated
回滚方案
git revert 即可回滚(恢复 calc-size 保底 + 96 截断滚动)。