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

Đang mở Phù hợp với người mới
#15,439 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
accessibility, frontend

Hướng nghiên cứu

Bắt đầu với trình xử lý sự kiện nhấp trong src/resources/projects/website/navigation/quarto-nav.js, được liên kết trong issue, rồi kiểm tra cách thanh thông báo được gỡ bỏ và tiếp theo tiêu điểm có thể chuyển đến đâu. Tái hiện trường hợp được báo cáo bằng cách đặt tiêu điểm vào button.quarto-announcement-action và nhấp vào đó, sau đó kiểm tra document.activeElement. Hoàn tất khi đóng thanh khiến tiêu điểm vẫn ở phần tử tiếp theo có thể nhận tiêu điểm, hoặc ở main với tabindex="-1" nếu không có phần tử nào như vậy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
JavaScript
Star
6.2k
Fork
492
Merge trung bình
13 giờ 51 phút
Pull request đã merge (30 ngày)
82

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/quarto-cli

Tất cả issue của quarto-dev/quarto-cli

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.