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

Abierto Apto para principiantes
#15,439 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript

Línea de trabajo

Empieza por el controlador de clics de src/resources/projects/website/navigation/quarto-nav.js, enlazado en el issue, e inspecciona cómo se elimina la barra de anuncios y dónde puede moverse el foco a continuación. Reproduce el caso reportado enfocando y haciendo clic en button.quarto-announcement-action; después, comprueba document.activeElement. El trabajo estará terminado cuando, al cerrar la barra, el foco permanezca en el siguiente elemento enfocable o, si no hay ninguno, en main con tabindex="-1".

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
JavaScript
Estrellas
6.2k
Forks
492
Merge medio
13 h 51 min
PR fusionados (30 d)
82

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/quarto-cli

Todos los issues de quarto-dev/quarto-cli

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.