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

Aperta Adatta ai principianti
#75 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
html, php

Direzione di ricerca

Inizia da app/Markdown/GithubFlavoredMarkdownConverter.php per vedere come le ancore dei titoli ricevono il prefisso content-, poi individua la gestione del caricamento della pagina e di hashchange nel sito web. Controlla il link #overview della pagina di esempio e verifica che i frammenti della stessa pagina e delle altre pagine facciano scorrere la pagina dopo il caricamento, mentre i link content- continuano a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
PHP
Stelle
3
Fork
11
Merge medio
1g 6h
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mage-os/devdocs-website

Tutte le issue di mage-os/devdocs-website

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.