Repository navigation
fix(shell): 恢复页签等比伸缩(flex-1 + 96 保底,移除 calc-size) - #1970
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.
变更概述
页签条随窗格变窄时不按可用宽度等比收缩、标题被还原成固定长度。按用户裁定,这是回归:#1155 方案 A / #1180 曾实现「页签弹性等比伸缩」,#1231 改为「不伸展 + 上限 256 +
calc-size()」退回固定长度。本 PR 恢复 #1180 等比分配(flex: 1 1 0等分可用宽度 +--tab-min-width96px 保底 + 溢出横向滚动),并移除calc-size()——后者仅 Chrome/Edge 支持、WebKit/WKWebView 全版本不支持,导致真机与 Chromium/e2e 行为分叉。关联 Issue
Closes #1843
变更内容
src/components/TabBar.tsx:页签元素恢复flex-1+minWidth: var(--tab-min-width);删除minWidth: calc-size(...)与maxWidth: var(--tab-max-width)。openspec/specs/navigation/spec.md+openspec/specs/application-shell/spec.md:页签条款改为「按可用宽度等比分配(flex: 1 1 0)+ 96px 保底 + 溢出横向滚动」,两域措辞一致;相关 Scenario 同步。docs/design/system/spec.md§7.5 +decisions.md:改为等比模型,--tab-max-width标注退役,append 台账行(supersede [change=surface-refine-1120/2.2] 页签最大宽度 #1231)。src/styles/tokens.css:token 注释同步(--tab-min-width等比语义、--tab-max-width退役,值不变)。e2e/tab-selection.spec.ts:重写依赖 [change=surface-refine-1120/2.2] 页签最大宽度 #1231 旧行为的断言为等比模型严格断言(等宽容差 ≤8、整体变窄、96 保底 +scrollWidth>clientWidth、单页签填满内容区),并产出.artifacts/1843/state-coverage.json(4 态)。影响范围
页签条布局:多页签等分可用宽度、随窗口等比伸缩;单页签按等比分配填满内容区(尾部空白区除外)——这是 #1180 模型的既定行为(与 #1231「单页签不顶满/短名按实际宽度」相反,按用户本次裁定恢复)。页签拖拽/右键/信息窗/关闭逻辑不变。
规格修正说明(请评审留意)
本 PR 直接修改了
openspec/specs/主规格(navigation / application-shell)以匹配恢复后的行为——这是对 #1231 已落库规格的回退,按用户「恢复 #1155 已解决行为」的裁定执行。若需走正式 change 归档,请在评审时指出。验证方式
tab-selection.spec.ts+tab-strip-dblclick.spec.ts:13 passed。scrollWidth(800) > clientWidth(538)(横向滚动接管);单页签 1200 → 974px(≈内容区 1038 − 24 tail − 32 gap)。.artifacts/1843/state-coverage.json(4 态 passed)。质量门禁引用
flex:0 1 auto + calc-size替换了 [change=shell-tabs-surface/1.1] 页签弹性等比伸缩 + 最小宽度保底 #1180 的flex-1等比分配(calc-size在 WKWebView 不支持)。风险评估
风险等级: medium(用户可见布局回退 + 主规格修改)
来源: ai-generated
回滚方案
git revert 即可回滚(同时恢复 #1231 行为)。