mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
* fix(a11y): translate the v2 primitives' own control labels
The library hard-coded 20 English strings for controls a primitive
renders on its own behalf, so screen-reader users heard English in every
locale: close on RDialog/RDrawer/RCarousel, remove on RChip/RSelect/
RComboboxField, clear on RTextField/RSelect/RComboboxField/RDateField,
RDateField's picker toggle and four month/year steppers, plus the
visible "Today" and "All" text.
The overridable-prop pattern was already there and had already failed:
RCarousel's closeLabel/prevLabel/nextLabel and RDateField's
clearLabel/todayLabel defaulted to English literals and no call site
ever passed one. Extending it would have made translation depend on
roughly 130 call sites each remembering to pass a label for a string
that is identical at every one of them.
Instead the app provides one bundle and every primitive reads it through
useChromeLabels(). The provider hands over getters that resolve via
i18n, so they run inside the reading component's render effect and a
locale switch re-renders the labels with no refs to unwrap. inject is
plain Vue, so lib still imports no i18n, and the English defaults keep a
bare mount rendering an accessible name. The existing label props stay
as per-instance overrides, now defaulting to undefined so they resolve
through the bundle.
Reuses common.close, common.clear, common.remove and common.all; adds
eight common.* keys across all 18 locales for the date-field steppers
and carousel navigation. setup.previous/next were left alone: they are
wizard step semantics ("previous step", "back"), not item navigation.
Storybook provides the same bundle, so stories exercise the real path.
Two tests guard the decay this had already suffered once: that an
injected bundle reaches a primitive's aria-label, and that every label
resolves to a real translation in every locale.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
* refactor: tighten the chrome-label comments and use import.meta.url
Condense the module header and the test's header to the repo's comment
limit, and derive the locales directory from import.meta.url rather than
__dirname, matching the review feedback on #4619.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
* fix(a11y): cover RAlert and RSteps, and test the real locale switch
RAlert's close button and RSteps' stepper name were missed on the first
pass: RAlert writes its label as a bound string literal
(:aria-label="'Close'") and RSteps builds "Step 2 of 5" from a template
string, neither of which the plain aria-label="Text" scan matched. Both
now read the injected bundle, which gains a step(current, total) member
backed by common.step-of across all 18 locales.
The locale-propagation test previously flipped a local variable and
called $forceUpdate, which only proved a getter re-reads on render. It
now mounts against createChromeLabels(), switches i18n.global.locale and
asserts the rendered label changes on its own, so it exercises the path
the app actually uses. RAlert and RSteps get assertions of their own.
Wrap the new skill bullet so it stops adding a markdownlint line-length
violation, and drop three comments that only restated the ?? beside them.
Reported by Copilot (RAlert) and Greptile (test, comments) on #4620.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
* fix(a11y): put RDateField's combobox role on its focusable input
The role sat on the field's wrapper div, which is not focusable and had
no aria-controls, so the two accessibility lints on it were right:
assistive tech saw a combobox it could not reach and that pointed at no
popup. The previous comment explained why the role could not go on
RTextField, and it was accurate: RTextField binds $attrs to its outer
element, which becomes a <label> when it owns the visible label, where
the role is disallowed.
So give RTextField a typed `popup` prop that lands role="combobox",
aria-haspopup, aria-expanded and aria-controls on the native input,
where ARIA 1.2 wants them. A single object prop rather than an attribute
bag keeps arbitrary attributes off the input. RDateField passes it,
drops the role from the wrapper (keeping the keydown handler, which is
what the wrapper is actually for) and gives the teleported panel a
useId() so aria-controls resolves.
The wrapper never was a tab stop, so no tab order changes: the input it
delegates to is the same element that now carries the role.
Covers the two vuejs-accessibility errors that eslint reported against
this file on master; src/v2/lib is now lint-clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
* fix(a11y): make popup and multiline exclusive, and tighten comments
The new `popup` prop rendered its combobox attributes only on the
<input> branch, so a caller that also set `multiline` type-checked but
got a plain <textarea> with none of the role, expanded state or popup
association it asked for. Binding them to the textarea instead is not an
option: ARIA in HTML allows no role override on <textarea>, so
role=combobox there would be invalid. The conflict now reports itself
through console.error rather than dropping the ARIA in silence, and the
prop documents the single-line constraint.
Adds RTextField.test.ts covering all three cases: the role landing on
the input while the <label> outer element stays clear of it, no
combobox attributes when the prop is absent, and the conflict being
reported.
Also drop a sentence recording what the code used to do, which CLAUDE.md
rules out, and shorten the RDateField template comment.
Reported by Greptile (both P2) on #4621.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
* chore(deps): declare the Vue 3.5 floor the code already requires
useId lands in Vue 3.5 and RComboboxField has been calling it on master,
so the declared ^3.4.27 range understated the real minimum: a resolution
inside 3.4 would fail to build. The lockfile already pins 3.5.29, so
this only corrects the manifest and changes no resolved version.
RTextField carried a comment claiming the project was "on 3.4 still",
which is what made useId look like a regression in review; it is gone,
and the architecture doc's framework row now matches.
Also stop advertising aria-controls while the picker is closed. The
panel is v-if'd, so the input pointed at an element that was not in the
document; `controls` is now optional and RDateField passes it only while
the panel is mounted, with the closed state asserted.
Reported by Copilot on #4621.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
* refactor: drop a comment recording what the code used to do
The describe name already states what the block verifies, and the rest
was change history, which CLAUDE.md rules out.
Reported by Greptile on #4620.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ENyaGKiTZiwPGH7qyN4iMe
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>