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

Offen Anfängerfreundlich
#15,439 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
84/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
javascript

Rechercherichtung

Beginne mit dem Click-Handler in src/resources/projects/website/navigation/quarto-nav.js, der im Issue verlinkt ist, und untersuche, wie die Ankündigungsleiste entfernt wird und wohin der Fokus als Nächstes wechseln kann. Reproduziere den gemeldeten Fall, indem du button.quarto-announcement-action fokussierst und anklickst, und prüfe dann document.activeElement. Die Aufgabe ist erledigt, wenn beim Schließen der Leiste der Fokus auf dem nächsten fokussierbaren Element bleibt oder, falls es keines gibt, auf main mit tabindex="-1".

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

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
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.