Customizable accessible names for the shell menu toggle and the alert close button

Đang mở Phù hợp với người mới
#1,632 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
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
handlebars, rust
Lĩnh vực
accessibility, frontend

Hướng nghiên cứu

Bắt đầu từ sqlpage/templates/shell.handlebars tại hai nút bật/tắt menu (dòng 174 và 208) và từ alert.handlebars tại nút đóng của cảnh báo có thể đóng, sau đó sao chép mẫu {{default …}} mà thành phần modal đã dùng cho close_label. Thêm hai dòng tài liệu cạnh các thuộc tính hiện có của thành phần, rồi thêm tests/sql_test_files/component_rendering/alert_close_label.sql và shell_navbar_toggle_label.sql, theo mẫu các bài kiểm thử kết xuất hiện có. Hoàn thành khi các thuộc tính mới thay đổi aria-label và các trang không có chúng vẫn hiển thị giá trị mặc định tiếng Anh.

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

Mô tả

enhancement

What we are building:

Public-sector web applications in German that have to meet WCAG 2.1 AA (the same applications as in #1612 and #1615).

Our problem:

A few accessible names are still hard-coded in English and have no property, so screen readers announce English words on an otherwise German page:

Component Element Fixed accessible name
shell menu toggle button on small screens (shell.handlebars, lines 174 and 208) "Toggle navigation"
alert close button of a dismissible alert (since #1614) "Close"

Visible texts of these components can already be customized (for example search_placeholder and search_button since #893, link_text on the alert), and the modal component has close_label for its close button. These two names were left out.

What are you currently doing?

We replace the aria-label attributes with JavaScript after the page loads. That works, but it depends on the markup of the templates and has to be re-checked after every SQLPage update.

Describe the solution you'd like

Two optional properties, with the current English text as default:

  • shell: navbar_toggle_label, used for both menu toggle buttons;
  • alert: close_label, the same name as on the modal component.
select 'shell' as component, 'Demo' as title, 'about' as menu_item,
    'Menü öffnen oder schließen' as navbar_toggle_label;
select 'alert' as component, 'Gespeichert' as title, TRUE as dismissible,
    'Schließen' as close_label;

The change is one {{default …}} per attribute, plus two documentation rows. I tried it locally by overriding both templates on v0.48.0: the accessibility tree in Chromium then shows button "Menü öffnen oder schließen" and button "Schließen", and pages without the new properties render exactly as before.

Describe alternatives you've considered

  • Built-in translations selected by the language property of the shell. That would need translation tables inside SQLPage; properties fit better with how #893 handled the other hard-coded strings.
  • Overriding the templates in sqlpage/templates/. That works, but then we have to merge every later change to shell.handlebars and alert.handlebars by hand.

Additional context

There are a few more fixed English texts that could follow the same pattern later, if wanted: the close button of the toast component ("Close notification"), and the title tooltips "Edit", "Delete" and "View" of the action icons in table and list. I left them out to keep this request small.

If wanted, I can provide a pull request with both properties, their documentation, a CHANGELOG entry and two rendering tests in tests/sql_test_files/component_rendering/ (alert_close_label.sql, shell_navbar_toggle_label.sql), which fail on v0.48.0 and pass with the change.

Ngôn ngữ chính
Rust
Star
2.6k
Fork
175
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
43

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 sqlpage/SQLPage

Tất cả issue của sqlpage/SQLPage

Issue tương tự

Thêm issue về Rust

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.