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

Aperta Adatta ai principianti
#15,438 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Inizia dal codice di tracciamento dello scorrimento in src/resources/formats/html/quarto.js, alle righe collegate, poi esamina il rendering dell’indice e i relativi test. Riproduci il comportamento segnalato con il documento Quarto a due sezioni e verifica che, scorrendo, aria-current="location" si aggiorni insieme alla voce attiva. Il lavoro è terminato quando la voce corrente ha l’attributo e le altre voci non lo hanno.

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

Descrizione

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
Lingua principale
JavaScript
Stelle
6.2k
Fork
492
Merge medio
13h 51m
PR unite (30g)
82

Preparare l'ambiente

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

Tutte le issue di quarto-dev/quarto-cli

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.