JedWatson / JedWatson/react-select
The default ariaLiveMessages implementation should use an option's aria-label if it is defined
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
We have a usage of react select where the options are a nested object (contain an SVG image, text, and a tooltip trigger). The default implementation of ariaLiveMessages uses an option's label as the text to display, so this results in an unusable experience for a screen reader.

I have worked around the issue by defining an aria-label for the option and registering custom callbacks for ariaLiveMessages that leverage aria-label. However, I believe that the default ariaLiveMessages implementation should use aria-label instead of label (if the aria attribute is defined) to prevent this issue in general.
Example RSelect code:
onFocus: function onFocus(props) {
var context = props.context,
focused = props.focused,
options = props.options,
_props$label2 = props.label,
label = _props$label2 === void 0 ? '' : _props$label2,
selectValue = props.selectValue,
isDisabled = props.isDisabled,
isSelected = props.isSelected;
var getArrayIndex = function getArrayIndex(arr, item) {
return arr && arr.length ? "".concat(arr.indexOf(item) + 1, " of ").concat(arr.length) : '';
};
if (context === 'value' && selectValue) {
return "value ".concat(label, " focused, ").concat(getArrayIndex(selectValue, focused), ".");
}
Example of custom code:
const onFocusAria = ({ focused, isDisabled }) => {
return `${isDisabled ? 'Disabled option ' : 'Option '}${focused['aria-label']}, focused.`
}
Resulting in:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the default ariaLiveMessages implementation, especially the onFocus path shown in the issue, and inspect how focused options expose label and aria-label values. Verify the behavior with an option containing nested content and an aria-label; done means the default announcements use aria-label when defined while preserving label otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100