Skip to content

[select] Stop using combobox element for labelling#48251

Merged
silviuaavram merged 2 commits intomui:masterfrom
silviuaavram:fix/select-label
Apr 14, 2026
Merged

[select] Stop using combobox element for labelling#48251
silviuaavram merged 2 commits intomui:masterfrom
silviuaavram:fix/select-label

Conversation

@silviuaavram
Copy link
Copy Markdown
Member

@silviuaavram silviuaavram commented Apr 9, 2026

With the current aria-labelledby value, a Select with a selected value will be read like: value + label + value. The last 'value' comes from the fact that aria-labelled has also the id of the combobox. Removing that will fix the double reading.

There are some cases where adding multiple elements to aria-labelledby might work, like how React Aria does. But in their case, the other id works like a placeholder, which we don't support.

@silviuaavram silviuaavram self-assigned this Apr 9, 2026
Copilot AI review requested due to automatic review settings April 9, 2026 14:30
@silviuaavram silviuaavram added accessibility a11y breaking change Introduces changes that are not backward compatible. scope: select Changes related to the select. labels Apr 9, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Apr 9, 2026

Netlify deploy preview

https://deploy-preview-48251--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-39B(-0.01%) ▼-19B(-0.01%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 4b528c5

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Material UI <Select /> accessibility labeling so the combobox element is no longer included in aria-labelledby, preventing screen readers from announcing the selected value twice.

Changes:

  • Update SelectInput to set aria-labelledby from labelId only (no self-reference).
  • Revise accessibility tests to reflect the updated labeling behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/mui-material/src/Select/SelectInput.js Stops including the combobox id in aria-labelledby, relying on labelId only.
packages/mui-material/src/Select/Select.test.js Updates a11y tests around labeling with/without labelId to match the new behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 525 to 529
aria-haspopup="listbox"
aria-label={ariaLabel}
aria-labelledby={[labelId, buttonId].filter(Boolean).join(' ') || undefined}
aria-labelledby={labelId}
aria-describedby={ariaDescribedby}
aria-required={required ? 'true' : undefined}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-labelledby={labelId} will still render an empty aria-labelledby attribute if labelId is an empty string. Previously, falsy values were filtered out. Consider using a falsy guard (e.g. labelId || undefined) so the attribute is omitted when labelId is empty/undefined, avoiding an invalid reference list.

Copilot uses AI. Check for mistakes.
Comment thread packages/mui-material/src/Select/Select.test.js Outdated
Comment thread packages/mui-material/src/Select/Select.test.js
@mj12albert mj12albert removed the breaking change Introduces changes that are not backward compatible. label Apr 10, 2026
Copy link
Copy Markdown
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the existing accName was plain wrong, IMO this doesn't count as breaking ~

@silviuaavram silviuaavram merged commit 4a7110b into mui:master Apr 14, 2026
19 checks passed
@silviuaavram silviuaavram deleted the fix/select-label branch April 14, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y scope: select Changes related to the select.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants