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

オープン 初心者向け
#15,439 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript

調査の方向性

issueにリンクされている src/resources/projects/website/navigation/quarto-nav.js のクリックハンドラーから始め、告知バーがどのように削除されるか、次にフォーカスを移動できる場所を調べてください。button.quarto-announcement-action にフォーカスしてクリックし、報告されたケースを再現してから、document.activeElement を確認してください。バーを閉じたとき、次にフォーカス可能な要素にフォーカスが残るか、該当する要素がなければ tabindex="-1" を指定した main にフォーカスが移れば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
JavaScript
スター
6.2k
フォーク
492
平均マージ
13時間 51分
マージ済み PR(30日)
82

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/quarto-cli のほかの issue

quarto-dev/quarto-cli の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。