Skip to content

Commit 2274539

Browse files
JohnMcLearclaude
andcommitted
fix(a11y): reuse translated history-controls label key (Qodo PR review)
Qodo flagged: adding `aria-labelledby="editbar-history-label"` on #history-controls overrode the `aria-label` that pad_mode.ts sets from `pad.historyMode.controlsLabel`. That key is already translated in multiple locales (en/de/nl/...); the new `pad.editor.toolbar.history` key was English-only, so non-English users would regress from a localized history-toolbar name to the English fallback. Point the hidden label span at the existing translated key instead of minting a new one, drop the new key from en.json, and update the Playwright expectation to match the translated string ("Pad history controls"). The aria-label that pad_mode.ts still writes to #history-controls is now redundant (aria-labelledby wins) but harmless, and leaving it preserves the runtime relocalization path. Refs #7777 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f294074 commit 2274539

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/locales/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@
364364
"pad.editor.keyboardHint": "Press Escape to exit the editor. Press Alt+F9 to access the toolbar.",
365365
"pad.editor.toolbar.formatting": "Formatting toolbar",
366366
"pad.editor.toolbar.actions": "Pad actions toolbar",
367-
"pad.editor.toolbar.history": "History playback toolbar",
368367
"pad.editor.toolbar.showMore": "Show more toolbar buttons",
369368
"timeslider.toolbar.authors": "Authors:",
370369
"timeslider.toolbar.authorsList": "No Authors",

src/templates/pad.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@
8686
accessible name via aria-labelledby. See ether/etherpad#7255. -->
8787
<span id="editbar-formatting-label" class="sr-only"
8888
data-l10n-id="pad.editor.toolbar.formatting">Formatting toolbar</span>
89+
<!-- Reuses pad.historyMode.controlsLabel rather than minting a new key:
90+
pad_mode.ts already set this as aria-label on #history-controls via JS,
91+
and the existing key has translations in nl/de/etc. A new English-only
92+
key would cause non-English locales to regress to fallback English. -->
8993
<span id="editbar-history-label" class="sr-only"
90-
data-l10n-id="pad.editor.toolbar.history">History playback toolbar</span>
94+
data-l10n-id="pad.historyMode.controlsLabel">Pad history controls</span>
9195
<span id="editbar-actions-label" class="sr-only"
9296
data-l10n-id="pad.editor.toolbar.actions">Pad actions toolbar</span>
9397
<span id="editbar-showmore-label" class="sr-only"

src/tests/frontend-new/specs/a11y_dialogs.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ test('editbar toolbars have role=toolbar with accessible names (#7255)', async (
161161
const cases: Array<[string, string, string]> = [
162162
['.menu_left', 'editbar-formatting-label', 'Formatting toolbar'],
163163
['.menu_right', 'editbar-actions-label', 'Pad actions toolbar'],
164-
['#history-controls', 'editbar-history-label', 'History playback toolbar'],
164+
// History toolbar reuses pad.historyMode.controlsLabel (already
165+
// translated in multiple locales) instead of a new English-only key.
166+
['#history-controls', 'editbar-history-label', 'Pad history controls'],
165167
];
166168
for (const [sel, labelId, expected] of cases) {
167169
const toolbar = page.locator(sel);

0 commit comments

Comments
 (0)