Skip to content

[input base] Place aria-label on the input element#48283

Merged
silviuaavram merged 3 commits into
mui:masterfrom
silviuaavram:fix/input-aria-label
Apr 14, 2026
Merged

[input base] Place aria-label on the input element#48283
silviuaavram merged 3 commits into
mui:masterfrom
silviuaavram:fix/input-aria-label

Conversation

@silviuaavram

@silviuaavram silviuaavram commented Apr 14, 2026

Copy link
Copy Markdown
Member

Noticed this issue while working on #48251.

The aria-label was not parsed from the props, and ended up on the input wrapper. It should be added on the input element instead.

@silviuaavram silviuaavram self-assigned this Apr 14, 2026
@silviuaavram silviuaavram added accessibility a11y scope: input Changes related to the input. labels Apr 14, 2026
@silviuaavram silviuaavram marked this pull request as ready for review April 14, 2026 08:35
Copilot AI review requested due to automatic review settings April 14, 2026 08:35
@mui-bot

mui-bot commented Apr 14, 2026

Copy link
Copy Markdown

Netlify deploy preview

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

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+30B(+0.01%) 🔺+28B(+0.02%)
@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 80a37d6

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes how aria-label is handled for components built on top of InputBase, ensuring the label is applied to the actual input element (and downstream components like SelectInput) rather than ending up on the outer wrapper.

Changes:

  • Forward aria-label from InputBase props to the inner Input slot (input element / inputComponent).
  • Add a regression test to ensure InputBase receives an accessible name/description from aria-label/aria-describedby.
  • Add a regression test to ensure Select’s combobox is labeled when aria-label is provided.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/mui-material/src/InputBase/InputBase.js Extracts and forwards aria-label to the inner input slot instead of the wrapper.
packages/mui-material/src/InputBase/InputBase.test.js Adds coverage for accessible name/description when aria-* props are provided.
packages/mui-material/src/Select/Select.test.js Adds coverage ensuring Select combobox is labeled via aria-label.

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

Comment thread packages/mui-material/src/InputBase/InputBase.js
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 14, 2026
@silviuaavram silviuaavram force-pushed the fix/input-aria-label branch from 80a37d6 to 3564124 Compare April 14, 2026 11:33
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 14, 2026
@code-infra-dashboard

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+30B(+0.01%) 🔺+27B(+0.02%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 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

Deploy preview

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


Check out the code infra dashboard for more information about this PR.

expect(input).not.to.have.attribute('required');
});

it('should be aria-labelled and aria-describedby if props are provided', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
it('should be aria-labelled and aria-describedby if props are provided', () => {
it('should apply both aria-label and aria-describedby when provided', () => {

@ZeeshanTamboli

Copy link
Copy Markdown
Member

One comment: #48283 (comment).

@silviuaavram silviuaavram merged commit 7481efa into mui:master Apr 14, 2026
19 checks passed
@silviuaavram silviuaavram deleted the fix/input-aria-label branch April 14, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility a11y scope: input Changes related to the input.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants