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

未關閉 適合新手
#1,632 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
84/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
handlebars, rust

研究方向

從 sqlpage/templates/shell.handlebars 中兩個選單切換按鈕(第 174 行和第 208 行)以及 alert.handlebars 中可關閉提示框的關閉按鈕開始,並複製 modal 元件為 close_label 已使用的 {{default …}} 模式。在現有元件屬性旁新增兩行文件,然後參照現有渲染測試,新增 tests/sql_test_files/component_rendering/alert_close_label.sql 和 shell_navbar_toggle_label.sql。完成的標準是:新屬性能改變 aria-label,而未設定這些屬性的頁面仍渲染英文預設值。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Rust
星號
2.6k
分支
175
平均合併
14 小時 16 分鐘
30 天內合併 PR
43

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

sqlpage/SQLPage 的其他 Issue

查看 sqlpage/SQLPage 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。