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

Offen Anfängerfreundlich
#1,632 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
84/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
handlebars, rust

Rechercherichtung

Beginne in sqlpage/templates/shell.handlebars bei den beiden Menü-Umschaltknöpfen (Zeilen 174 und 208) und in alert.handlebars beim schließbaren Schaltknopf zum Schließen, und kopiere das bereits von der Komponente modal für close_label verwendete Muster {{default …}}. Füge die beiden Dokumentationszeilen neben den bestehenden Komponenteneigenschaften hinzu und ergänze dann tests/sql_test_files/component_rendering/alert_close_label.sql und shell_navbar_toggle_label.sql nach dem Vorbild der bestehenden Rendering-Tests. Fertig ist, wenn die neuen Eigenschaften das aria-label ändern und Seiten ohne sie weiterhin die englischen Standardtexte rendern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Rust
Sterne
2.6k
Forks
175
Ø Merge
14 Std. 16 Min.
Gemergte PRs (30 T.)
43

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus sqlpage/SQLPage

Alle Issues in sqlpage/SQLPage

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.