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

Offen Anfängerfreundlich
#75 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
html, php

Rechercherichtung

Beginne mit app/Markdown/GithubFlavoredMarkdownConverter.php, um zu sehen, wie Überschriftenanker das Präfix content- erhalten, und suche dann die Behandlung des Seitenladens und von hashchange auf der Website. Prüfe den #overview-Link der Beispielseite und verifiziere, dass Fragmente auf derselben Seite und seitenübergreifende Fragmente nach dem Laden scrollen, während content--Links weiterhin funktionieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.
Vorherrschende Sprache
PHP
Sterne
3
Forks
11
Ø Merge
1 T. 6 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus mage-os/devdocs-website

Alle Issues in mage-os/devdocs-website

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.