Skip to content

fix(ui): keep the active prompt tick visible after resize - #2572

Merged
Astro-Han merged 1 commit into
apache:mainfrom
me2seeks:fix/2324-prompt-rail-resize
Aug 12, 2026
Merged

Astro-Han merged 1 commit into
apache:mainfrom
me2seeks:fix/2324-prompt-rail-resize

Conversation

@me2seeks

@me2seeks me2seeks commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

The prompt rail currently corrects its active tick only when the active turn changes. When the composer or window later reduces the rail viewport, that same tick can become hidden even though the active turn has not changed.

This keeps the existing rail-only scroll arithmetic and rechecks it whenever the rail's own box resizes. The observer is disconnected with the component effect, and focused coverage exercises both lower and upper overflow after a resize.

Fixes #2324

中文对照

Prompt rail 目前只在激活 turn 变化时校正激活刻度。如果 composer 或窗口随后压缩了 rail 的可视区域,激活 turn 虽未变化,对应刻度仍可能被遮住。

本 PR 保留现有只滚动 rail 的位置计算,并在 rail 自身尺寸变化时重新校正。observer 会随组件 effect 断开;聚焦测试覆盖了 resize 后刻度从下方和上方溢出的情况。

Verification

  • npm --workspace @maka/ui test — 264 tests passed
  • npx biome check packages/ui/src/prompt-anchor-rail.tsx packages/ui/src/__tests__/prompt-anchor-rail.test.ts
  • git diff --check origin/main...HEAD

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — the active prompt tick remains visible when the rail viewport resizes
  • No

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — I found no reproducible P0–P3 issues at dc74d257.

This fixes the actual ownership gap cleanly. The active prompt was already correct; what became stale was the rail’s independent viewport geometry. Observing the rail itself therefore follows the real source of change without copying window or composer dimensions into another state path.

The implementation also preserves the existing rail-only scrollTop correction instead of switching to scrollIntoView, so it cannot accidentally move the transcript ancestor. The focused test covers both overflow directions, the initially visible case, the observed target, and cleanup. I do not see low-value coverage or production code that should be removed.

I also checked the three-way combination with current main after #2680. It merges without conflict and retains both the required scrollBehavior contract and this resize correction.

中文对照

批准——在当前 head dc74d257 上没有发现可复现的 P0–P3 问题。

这个改动准确修复了真实的职责缺口。active prompt 本身一直是正确的;失效的是独立变化的 rail viewport 几何。因此直接观察 rail 是符合真实变化来源的方案,不需要把 window 或 composer 尺寸复制到另一条状态路径中。

实现还保留了原有只调整 rail 的 scrollTop 逻辑,没有改成 scrollIntoView,因此不会意外滚动 transcript ancestor。聚焦测试覆盖了上下两个溢出方向、初始已可见状态、observer 目标以及 cleanup。我没有看到应当删除的低价值测试或生产代码。

我也核对了它与 #2680 合并后的当前 main 的三方组合:没有冲突,并且会同时保留必填的 scrollBehavior 契约和本 PR 的 resize 修复。

Disclosure: Codex assisted by inspecting the full diff, issue reproduction evidence, observer lifecycle, focused tests, CI, and the three-way combination with current main. Astro-Han reviewed the resulting evidence, determined the finding threshold, and made the final approval decision.

@Astro-Han
Astro-Han merged commit e6034ac into apache:main Aug 12, 2026
12 checks passed
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.

fix(ui): keep the prompt rail highlight inside the rail when the rail resizes

2 participants