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

Aberta Para iniciantes
#15,438 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
80/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
javascript

Direção de pesquisa

Comece pelo código de rastreamento da rolagem em src/resources/formats/html/quarto.js, nas linhas vinculadas, e depois examine a renderização do sumário e seus testes. Reproduza o comportamento relatado com o documento Quarto de duas seções e verifique se, ao rolar, aria-current="location" é atualizado junto com a entrada ativa. O trabalho está concluído quando a entrada atual tem o atributo e as outras entradas não têm.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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
Linguagem predominante
JavaScript
Estrelas
6.2k
Forks
492
Merge médio
13h 51min
PRs com merge (30d)
82

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de quarto-dev/quarto-cli

Todas as issues de quarto-dev/quarto-cli

Issues semelhantes

Mais issues de JavaScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.