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

オープン 初心者向け
#75 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
html, php

調査の方向性

まず app/Markdown/GithubFlavoredMarkdownConverter.php で見出しアンカーに content- プレフィックスが付与される仕組みを確認し、次にウェブサイトのページ読み込みと hashchange の処理箇所を探してください。サンプルページの #overview リンクを確認し、同じページ内および別ページのフラグメントが読み込み後にスクロールすることと、content- リンクが引き続き機能することを検証してください。

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
PHP
スター
3
フォーク
11
平均マージ
1日 6時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mage-os/devdocs-website のほかの issue

mage-os/devdocs-website の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。