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

Đang mở Phù hợp với người mới
#65,384 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@AdityaSrivastava185 đang làm issue này rồi.

Từ ngày 21/11/2026.

  • #65387 của @AdityaSrivastava185 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
css, typescript
Lĩnh vực
documentation, frontend

Hướng nghiên cứu

Bắt đầu bằng việc xác định component render danh sách "Contents" bên phải và theo dõi heading đang active trên site docs; payload không nêu tên file nào, nên hãy đi theo đường render mục lục từ trang Intro của docs. Tái hiện bằng cách nhấp vào "Desktop", "Web" và "Docker" trên một trang có các section ngắn, sau đó kiểm tra cách heading active được chọn so với viewport và so sánh với scroll-margin-top của từng heading. Hoàn tất nghĩa là section được nhấp sẽ được highlight và các section ngắn không còn khiến mục tiếp theo trở thành active.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
227k
Fork
30.7k
Merge trung bình
3 giờ 57 phút
Pull request đã merge (30 ngày)
484

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.