You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stepper accessible name is a hardcoded English literal with no prop or locale to change it #757
A screen reader therefore announces "Increase Value" on every InputNumber stepper, in an application
whose language is not English. The visible field is usually named by the consumer, so this is easy to
miss until someone turns on a screen reader.
StepHandler destructures those props and there is no rest spread, so no prop reaches the span. There is
no aria-label, no locale, and nothing on InputNumberProps to translate it with either.
Two routes that look available are not:
upHandler / downHandler only replace the children. They render inside the span that already
carries role="button" and the English name, so the accessible name is unchanged, and a button inside
that button is worse than the original problem.
Ant Design's ConfigProvider locale cannot reach it. The literal is below antd's layer, in this
package, and is not part of antd's locale table. An antd en_US/id_ID swap does not change it.
The only thing that does work is setting the attribute on the rendered element after mount — which is what
a consumer is currently doing. That fights the framework: React re-applies the literal on every re-render
the component performs on its own (typing does), so the name reverts and has to be re-applied, via an
observer.
Suggested
Any one of these would make it possible without mutating the DOM:
Accept the names — upAriaLabel / downAriaLabel, or a single handlerAriaLabels={{ up, down }}.
Smallest change, opt-in, and no default behaviour moves.
Read from a locale object, as other rc-components already do, so a single provider covers every
string this package speaks rather than one prop per string.
At minimum, spread rest props onto the span. That alone would let antd — or any consumer wrapper —
set the name without a separate prop on StepHandlerProps.
(1) is the cheapest and the least likely to conflict with antd's own plans; (2) is the more complete fix.
Happy to send a PR for either, including tests. Please say which you would prefer.
Activity