a11y: localize aria-label on form-control elements (<select>, <input>, <textarea>)#7713
Merged
JohnMcLear merged 1 commit intodevelopfrom May 10, 2026
Merged
Conversation
…, <textarea>) #7584 introduced auto-population of aria-label from a translation when an element has data-l10n-id and no author-supplied aria-label. That branch only fires for elements with no children (or with data-l10n-id ending in a recognized attribute suffix like .title). Form-control elements break the assumption: a <select> always has <option> children, an <input>/<textarea> may have implicit value content. The textContent branch handles them, but the aria-label fallback wasn't called from there. Plugins like ep_font_size, ep_headings2, and ep_hljs end up with a localized translation applied to a <select> but no accessible name on the element itself. Calls populateAriaLabel() from the textContent branch when the node is a <select>, <input>, or <textarea>. Keeps the same "author-supplied aria-label wins on first pass; the data-l10n-aria-label marker lets us refresh values we wrote" semantics from #7584. Adds Playwright coverage in src/tests/frontend-new/specs/html10n_form_controls_aria.spec.ts: - aria-label is populated on <select> with data-l10n-id - aria-label is populated on <textarea> with data-l10n-id - author-supplied aria-label is preserved on first pass
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
Review Summary by QodoAuto-populate aria-label on form-control elements in html10n
WalkthroughsDescription• Refactor aria-label population into reusable closure in html10n • Call populateAriaLabel() for form controls in textContent branch • Add Playwright tests for aria-label auto-population on form controls • Ensure <select>, <input>, <textarea> get localized accessible names Diagramflowchart LR
A["translateNode() called"] --> B{"Element has children?"}
B -->|No or attribute suffix| C["Apply translation"]
C --> D["populateAriaLabel()"]
B -->|Yes, textContent| E["Update child nodes"]
E --> F{"Form control?"}
F -->|SELECT/INPUT/TEXTAREA| D
F -->|Other| G["Done"]
D --> H["Set aria-label from translation"]
H --> G
File Changes1. src/static/js/vendors/html10n.ts
|
Code Review by Qodo
1. Misleading <select> warning
|
This was referenced May 10, 2026
Merged
Merged
Merged
Merged
JohnMcLear
added a commit
to ether/ep_font_color
that referenced
this pull request
May 10, 2026
#156) ether/etherpad#7713 extends html10n's aria-label auto-population to cover form-control elements (<select>, <input>, <textarea>). On newer etherpad with that fix, html10n overwrites aria-label with the localized translation when the data-l10n-aria-label="true" marker is present. Adds the marker (and keeps the existing hardcoded aria-label) so: - older etherpad without the html10n fix: aria-label remains the hardcoded English fallback (no regression); - newer etherpad with the html10n fix: aria-label gets the localized translation, refreshed on pad.applyLanguage(). Also drops the no-op data-l10n-attr="aria-label" attribute (etherpad's html10n doesn't read it; that's a convention from a different localization library).
JohnMcLear
added a commit
to ether/ep_font_family
that referenced
this pull request
May 10, 2026
#149) ether/etherpad#7713 extends html10n's aria-label auto-population to cover form-control elements (<select>, <input>, <textarea>). On newer etherpad with that fix, html10n overwrites aria-label with the localized translation when the data-l10n-aria-label="true" marker is present. Adds the marker (and keeps the existing hardcoded aria-label) so: - older etherpad without the html10n fix: aria-label remains the hardcoded English fallback (no regression); - newer etherpad with the html10n fix: aria-label gets the localized translation, refreshed on pad.applyLanguage(). Also drops the no-op data-l10n-attr="aria-label" attribute (etherpad's html10n doesn't read it; that's a convention from a different localization library).
JohnMcLear
added a commit
to ether/ep_font_size
that referenced
this pull request
May 10, 2026
#138) ether/etherpad#7713 extends html10n's aria-label auto-population to cover form-control elements (<select>, <input>, <textarea>). On newer etherpad with that fix, html10n overwrites aria-label with the localized translation when the data-l10n-aria-label="true" marker is present. Adds the marker (and keeps the existing hardcoded aria-label) so: - older etherpad without the html10n fix: aria-label remains the hardcoded English fallback (no regression); - newer etherpad with the html10n fix: aria-label gets the localized translation, refreshed on pad.applyLanguage(). Also drops the no-op data-l10n-attr="aria-label" attribute (etherpad's html10n doesn't read it; that's a convention from a different localization library).
JohnMcLear
added a commit
to ether/ep_headings2
that referenced
this pull request
May 10, 2026
#178) ether/etherpad#7713 extends html10n's aria-label auto-population to cover form-control elements (<select>, <input>, <textarea>). On newer etherpad with that fix, html10n overwrites aria-label with the localized translation when the data-l10n-aria-label="true" marker is present. Adds the marker (and keeps the existing hardcoded aria-label) so: - older etherpad without the html10n fix: aria-label remains the hardcoded English fallback (no regression); - newer etherpad with the html10n fix: aria-label gets the localized translation, refreshed on pad.applyLanguage(). Also drops the no-op data-l10n-attr="aria-label" attribute (etherpad's html10n doesn't read it; that's a convention from a different localization library).
JohnMcLear
added a commit
to ether/ep_hljs
that referenced
this pull request
May 10, 2026
#10) ether/etherpad#7713 extends html10n's aria-label auto-population to cover form-control elements (<select>, <input>, <textarea>). On newer etherpad with that fix, html10n overwrites aria-label with the localized translation when the data-l10n-aria-label="true" marker is present. Adds the marker (and keeps the existing hardcoded aria-label) so: - older etherpad without the html10n fix: aria-label remains the hardcoded English fallback (no regression); - newer etherpad with the html10n fix: aria-label gets the localized translation, refreshed on pad.applyLanguage(). Also drops the no-op data-l10n-attr="aria-label" attribute (etherpad's html10n doesn't read it; that's a convention from a different localization library).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#7584 introduced auto-population of
aria-labelfrom a translation when an element hasdata-l10n-idand no author-suppliedaria-label. That branch inhtml10n.ts:translateNodeonly fires for elements with no children (or with adata-l10n-idending in a recognized attribute suffix like.title).Form-control elements break the assumption: a
<select>always has<option>children, an<input>or<textarea>may have implicit value content. ThetextContentbranch handles them, but the aria-label fallback wasn't called from there. Plugins like ep_font_size, ep_headings2, and ep_hljs end up with a localized translation applied to a<select>but no accessible name on the element itself.This PR factors the aria-label population out into a closure and calls it from the
textContentbranch when the node is a form control (<select>,<input>,<textarea>). Same "author-supplied aria-label wins on first pass; thedata-l10n-aria-labelmarker lets us refresh values we wrote" semantics from #7584.Test plan
New file:
src/tests/frontend-new/specs/html10n_form_controls_aria.spec.ts<select>withdata-l10n-id<textarea>withdata-l10n-iddata-l10n-aria-labelmarker)Background
Surfaced during the fleet-wide plugin a11y/i18n sweep — when we removed redundant hardcoded English
aria-labels from<select>toolbar controls in plugins (ep_font_*, ep_hljs, ep_headings2), they ended up with no accessible name because of this gap. Stopgap was to restore the hardcoded English aria-labels; this PR removes the need for that workaround.