Skip to content

fix(canvas): give the selected tab the stronger state fill - #1

Open
youking-lib wants to merge 1 commit into
mainfrom
fix/canvas-tab-selection-fill
Open

youking-lib wants to merge 1 commit into
mainfrom
fix/canvas-tab-selection-fill

Conversation

@youking-lib

Copy link
Copy Markdown
Contributor

Motivation

顶部 canvas tab 条的选中态直接使用工作区底色,与 tab 条同色、只剩一圈 0.5px 内描边;而 hover 会叠加更亮的浮层,且 hover 规则同样命中选中的 tab 并覆盖它的填充,于是“悬停”比“选中”更亮,选中态在指针移上去时直接消失,读起来像是 active 与 hover 反了。

没有对应的 Issue:问题由用户在会话中直接反馈(附截图)。

Changes

Interface changes: None。

Behavior changes:

  • 选中的 tab 改用 --dsw-alias-interactive-bg-active(深色为白 14%,浅色为黑 10%),不再是工作区底色。
  • hover 规则收窄为 .tab:not([data-active]):hover,只作用于未选中的 tab;选中的 tab 悬停时保持选中填充。
  • 最终层级:深色 选中 rgb(54,54,56) > hover rgb(40,40,41) > tab 条 rgb(21,21,23);浅色 选中 rgb(233,235,238) > hover rgb(242,243,244) > tab 条 rgb(255,255,255)。

GUI 演示:本 PR 未内嵌 GIF。当前工作区存在并发进行中的其他改动,无法从干净的树完成构建并启动真实服务录制应用级演示;改用规则级浏览器渲染对照验证(真实 design-platform.css token + 真实 tab 规则 + 真实 DOM 结构),覆盖“指针移开 / 悬停在其他 tab / 悬停在选中 tab”三种场景,见 Testing。

Testing

Test design:本次为纯样式行为变更,用行为矩阵覆盖三种指针场景与两个主题,并读取浏览器计算后的 background-color,直接证明层级关系;现有客户端行为测试与仓库 typecheck 作为回归面。

场景 改动前 改动后 覆盖方式
深色,指针移开 选中 rgb(21,21,23),与 tab 条相同 选中 rgb(54,54,56) 规则级渲染,计算样式
深色,悬停其他 tab hover rgb(40,40,41) 亮于选中 选中 54 亮于 hover 40 规则级渲染,计算样式
深色,悬停选中的 tab 选中填充被替换为 rgb(40,40,41) 保持 rgb(54,54,56) 规则级渲染,计算样式
浅色,三种场景 选中 rgb(255,255,255),hover rgb(242,243,244) 选中 rgb(233,235,238),hover rgb(242,243,244) 规则级渲染,计算样式

Test entries:

  1. node node_modules/vitest/vitest.mjs run packages/plugin-renderer/tests(本地)— Convax renderer 客户端与 Host 行为回归,42 个测试文件 / 471 个用例全部通过,其中包含 tab 切换、拖拽排序、键盘移动与焦点恢复。
Proof
 Test Files  42 passed (42)
      Tests  471 passed (471)
   Duration  16.11s
  1. pnpm run typecheck(本地)— 仓库类型检查,9 个 task 全部成功(改动仅 CSS,无类型面变化)。
Proof
 Tasks:    9 successful, 9 total
Cached:    3 cached, 9 total
  Time:    27.853s
  1. Playwright 规则级渲染对照(本地,Chromium,design-platform.css 真实 token)— 三种场景 × 深浅主题,读取 [data-active] 与 hover tab 的 background-color;改动前 hover 会覆盖选中填充,改动后选中始终最高。
Proof
before idle   {"active":"rgb(21, 21, 23)",   "other":"rgba(0, 0, 0, 0)"}
before other  {"active":"rgb(21, 21, 23)",   "other":"rgba(255, 255, 255, 0.08)"}
before active {"active":"rgba(255,255,255,0.08)", "other":"rgba(0, 0, 0, 0)"}
after  idle   {"active":"rgba(255,255,255,0.14)", "other":"rgba(0, 0, 0, 0)"}
after  other  {"active":"rgba(255,255,255,0.14)", "other":"rgba(255, 255, 255, 0.08)"}
after  active {"active":"rgba(255,255,255,0.14)", "other":"rgba(0, 0, 0, 0)"}

AI Usage

AI-DECLARATION: auto

AI declaration (v0.1.2): auto

阶段 级别 AI 参与度 决策记录
breakdown 问题拆解 pair 人工引导 40% 作者指出顶部 tab 的 active 与 hover 观感相反,Agent 定位到选中态用工作区底色、hover 叠加浮层且覆盖选中填充两个原因。
design 方案设计 auto 模型自主 90% Agent 给出“选中用 active 浮层 + hover 排除选中 tab”的方案,并说明为何不用面板的实体色;作者采纳。
testing 验收测试 auto 模型自主 90% Agent 设计三种指针场景 × 两个主题的对照矩阵并执行;作者只要求“验证一下”。
implementation 技术实现 auto 模型自主 95% Agent 修改两处 CSS 规则并保持既有 tab 组件结构与可访问性不变。
review 评审处理 n/a 暂不适用 — 尚未处理评审意见。

The selected tab painted the workspace base colour, the same colour as the
bar behind it, so selection showed only as a hairline while a hovered tab
painted a lighter overlay. The hover rule also matched the selected tab and
replaced its fill.

Paint the selected tab with the active overlay and exclude it from the hover
rule, so hover stays below selection in both themes.

Co-authored-by: Codex <codex@openai.com>

This branch has not been deployed

No deployments
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.

1 participant