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

Aperta Adatta ai principianti
#1,632 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
handlebars, rust

Direzione di ricerca

Inizia da sqlpage/templates/shell.handlebars nei due pulsanti di attivazione del menu (righe 174 e 208) e da alert.handlebars nel pulsante di chiusura dell'avviso chiudibile, e copia il pattern {{default …}} già usato dal componente modal per close_label. Aggiungi le due righe di documentazione accanto alle proprietà esistenti del componente, quindi aggiungi tests/sql_test_files/component_rendering/alert_close_label.sql e shell_navbar_toggle_label.sql, modellandoli sui test di rendering esistenti. Il lavoro è completo quando le nuove proprietà modificano l'aria-label e le pagine senza di esse continuano a mostrare i valori predefiniti in inglese.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
2.6k
Fork
175
Merge medio
14h 16m
PR unite (30g)
43

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sqlpage/SQLPage

Tutte le issue di sqlpage/SQLPage

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.