[Site] Active section detection should respect scroll-margin-top

未关闭 适合新手
#65,384 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@AdityaSrivastava185 已经在做这个了。

开始于 2026年11月21日。

  • #65387 来自 @AdityaSrivastava185 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
css, typescript

调研方向

先从定位在 docs 站点上渲染右侧 "Contents" 列表并跟踪 active heading 的组件开始;payload 没有指明文件,所以从 docs 的 Intro 页面开始沿目录渲染路径排查。通过在包含短 section 的页面上点击 "Desktop"、"Web" 和 "Docker" 来复现,然后检查 active heading 相对于 viewport 是如何被选中的,并将其与每个 heading 的 scroll-margin-top 进行比较。完成意味着被点击的 section 会高亮,且短 section 不再导致下一项变为 active。

由索引模型根据 Issue 内容生成。

描述

area/web reproduced type/bug
Description
Issue

On the docs Intro page, clicking an item in the right-hand "Contents" list
scrolls to that section, but the next item gets highlighted instead.

Example: clicking "Desktop" highlights "Web". Clicking "Web" highlights
"Docker". It happens where sections are short.

Currently, the active section is determined using the heading's position relative to the viewport. This can cause the sidebar to highlight a section at the wrong time, especially when headings have an offset for sticky headers.

Expected Behaviour

Active section detection should respect each heading's scroll-margin-top value so that the correct section is highlighted when the heading reaches its intended scroll position

Plugins

No response

OpenCode version

No response

Steps to reproduce
  1. Open any documentation page on the OpenCode website.
  2. Navigate through sections using the table of contents/sidebar.
  3. Click "Desktop" in the Contents list. .
  4. Observe that the active section in the sidebar may not update at the expected scroll position.
Screenshot
issue-01 issue-02
Operating System

macOS 26.5

Terminal

No response

主要语言
TypeScript
星标
227k
派生
30.7k
平均合并
3 小时 57 分钟
30 天内合并 PR
484

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。