Links to a section of a page don't scroll to it

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

Chưa có ai nhận issue này.

Đá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
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
html, php
Lĩnh vực
documentation, frontend

Hướng nghiên cứu

Bắt đầu với app/Markdown/GithubFlavoredMarkdownConverter.php để xem các anchor tiêu đề nhận tiền tố content- như thế nào, rồi tìm phần xử lý tải trang và hashchange của website. Kiểm tra liên kết #overview của trang ví dụ và xác minh rằng các fragment trên cùng trang và trên trang khác sẽ cuộn đến vị trí tương ứng sau khi tải, trong khi các liên kết content- vẫn hoạt động.

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

Mô tả

A link to a section of a page opens the page but doesn't scroll to the section.

Why

The docs pages link to sections the way GitHub renders them: [text](#overview) or [text](/docs/{{version}}/rest-apis#errors). The website gives every heading an anchor with a content- prefix (heading_permalink in app/Markdown/GithubFlavoredMarkdownConverter.php), so the page has id="content-overview" and no id="overview".

Example

https://devdocs.mage-os.org/docs/main/integration-testing starts with a list of links such as #overview. Clicking one changes the URL and nothing else.

Scope

  • main today: 49 such links on 3 pages (integration-testing, events, javascript-in-magento-2).
  • With the open pull requests in mage-os/devdocs merged: 16 links on 13 pages, 6 of them to a section of another page.

The table of contents and the heading permalinks are generated with the prefix and work.

Proposal

Keep the pages as they are, since their links also work on GitHub, and let the website resolve them: when the fragment of the URL matches no element, scroll to the element with the content- prefix instead, on page load and on hashchange.

Done when

  • [text](#section) scrolls to the section.
  • A link to a section of another page scrolls to it after the page has loaded.
  • Links with the content- prefix keep working.
Ngôn ngữ chính
PHP
Star
3
Fork
11
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
1

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 mage-os/devdocs-website

Tất cả issue của mage-os/devdocs-website

Issue tương tự

Thêm issue về PHP

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.