The current entry of the table of contents has no `aria-current`

Offen Anfängerfreundlich
#15,438 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

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

Rechercherichtung

Beginne mit dem Scroll-Tracking-Code in src/resources/formats/html/quarto.js an den verlinkten Zeilen und untersuche anschließend die Darstellung des Inhaltsverzeichnisses und dessen Tests. Reproduziere das gemeldete Verhalten mit dem Quarto-Dokument mit zwei Abschnitten und prüfe, ob beim Scrollen aria-current="location" zusammen mit dem aktiven Eintrag aktualisiert wird. Fertig ist die Aufgabe, wenn der aktuelle Eintrag das Attribut hat und die anderen Einträge nicht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

accessibility bug
I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

In the table of contents, Quarto marks the entry for the section in view with class="active" only.
A screen reader cannot tell which entry is current.
The class gives this information to sighted users only, which fails WCAG 4.1.2 Name, Role, Value (Level A).

The scroll tracking only adds and removes the class:

The navbar already sets aria-current="page", and #15190 reports the same gap for the sidebar link of the current page.
The table of contents needs the same, for example aria-current="location" on the active entry.

Steps to reproduce
---
title: TOC
format:
  html:
    toc: true
---

## One

Text.

## Two

Text.

In the rendered page, read the attributes of the entries:

[...document.querySelectorAll("#TOC .nav-link")].map((a) => [a.className, a.getAttribute("aria-current")]);
Actual behavior
[["nav-link active", null], ["nav-link", null]]
Expected behavior

The active entry has aria-current="location", and the other entries have no aria-current.
The attribute follows the active class when the reader scrolls.

Your environment
  • Quarto: 99.9.9 (development build, commit 83432c0).
  • Browser: Chromium (Playwright).
  • OS: macOS 27.2.1.
Quarto check output
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.13.0: OK
      Dart Sass version 1.107.1: OK
      Deno version 2.9.8: OK
      Typst version 0.15.1: OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 83432c028f6c07167c23f948da7067b37fe8a18b
Vorherrschende Sprache
JavaScript
Sterne
6.2k
Forks
492
Ø Merge
13 Std. 51 Min.
Gemergte PRs (30 T.)
82

Entwicklungsumgebung

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 quarto-dev/quarto-cli

Alle Issues in quarto-dev/quarto-cli

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

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