Focus falls to the body when a keyboard user dismisses the announcement bar

Aberta Para iniciantes
#15,439 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
84/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
javascript

Direção de pesquisa

Comece pelo manipulador de clique em src/resources/projects/website/navigation/quarto-nav.js, vinculado na issue, e inspecione como a barra de anúncio é removida e para onde o foco pode se mover em seguida. Reproduza o caso relatado focando e clicando em button.quarto-announcement-action e, então, verifique document.activeElement. O trabalho estará concluído quando fechar a barra deixar o foco no próximo elemento que pode receber foco ou, se não houver nenhum, em main com tabindex="-1".

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

When a keyboard user presses the dismiss button of the announcement bar, Quarto removes the bar, and the focused button goes with it.
Focus falls back to <body>, so the next Tab starts again from the top of the page.
A screen reader user loses their place too.
This fails WCAG 2.4.3 Focus Order (Level A).

#15253 made the control a button that works with the keyboard (#15235).
The click handler only hides the bar:

When the bar had focus, the handler should move focus to the next focusable element after the bar, or to <main> (with tabindex="-1") when there is none.

Steps to reproduce

_quarto.yml:

project:
  type: website
website:
  title: Announcement
  navbar:
    left:
      - href: index.qmd
        text: Home
  announcement:
    content: This is an announcement.
    dismissable: true
format: html

index.qmd:

---
title: Home
---

Home page.

Render the website, open index.html, Tab to the dismiss button, and press Enter.
The same check in a script:

document.querySelector("button.quarto-announcement-action").focus();
document.querySelector("button.quarto-announcement-action").click();
document.activeElement.tagName;
Actual behavior

The bar is removed and document.activeElement is BODY.

Expected behavior

The bar is removed and focus is on a control that is still on the page, such as the next link in the navbar.

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.