fix: English aria-label fallbacks when locale keys are unresolved (#196)#254
Open
johnleider wants to merge 1 commit into
Open
fix: English aria-label fallbacks when locale keys are unresolved (#196)#254johnleider wants to merge 1 commit into
johnleider wants to merge 1 commit into
Conversation
…olved Components route user-facing strings (aria-label, aria-valuetext, live-region text) through locale.t(). With no locale messages configured, t() returns the key verbatim, so labels degraded to dotted keys like "Dialog.close" — a WCAG 4.1.2 defect in the default configuration. Each site now coalesces to a concise English default when t() returns the key unchanged, matching the pattern already used in AvatarIndicator. A consumer-supplied locale still overrides. Updates PHILOSOPHY 5.5 and the Breadcrumbs/NumberField/Pagination tests that pinned to or selected by the raw key. Closes #196
|
commit: |
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.
Closes #196.
Problem
Components emit user-facing strings (
aria-label,aria-valuetext, live-region text) vialocale.t(key). v0 ships no default message bundle, so when no locale is configured — the out-of-box default —t()returns the key verbatim. Screen readers then announce dotted keys like "Dialog dot close", "Pagination dot next" across ~16 components. That's a WCAG 4.1.2 (Name, Role, Value) defect in the default configuration.Fix
Each call site coalesces to a concise English default when
t()returns the key unchanged:This is the per-component default approach already established in
AvatarIndicator(translated === LABEL_KEY ? \+${count}` : translated) — not a new mechanism. It deliberately avoids the two previously-rejected approaches: it does **not** add a fallback parameter tot()`, and it does not ship a default message bundle. A consumer-supplied locale always overrides; the English default is only the out-of-box accessibility floor.Interpolated keys (Carousel slide counts, Pagination page numbers, Rating value text, the Pagination/Carousel live regions) keep their interpolation in the fallback.
Scope
PHILOSOPHY.md§5.5 updated to document the fallback as the accessibility floortoBeDefined(), not exact text" rule)