Skip to content

Commit

Permalink
[Select][material-ui] Missing aria-multiselectable attribute on multi…
Browse files Browse the repository at this point in the history
…ple Select component (#38855)

Co-authored-by: AsiwajuDev <[email protected]>
  • Loading branch information
gitstart and AsiwajuDev committed Sep 19, 2023
1 parent 96f2688 commit 5ae040f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/mui-material/src/Select/Select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,20 @@ describe('<Select />', () => {
expect(options[2]).to.have.attribute('aria-selected', 'true');
});

it('should have aria-multiselectable=true when multiple is true', () => {
const { getByRole } = render(
<Select multiple value={[10, 30]}>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>,
);

fireEvent.mouseDown(getByRole('button'));

expect(getByRole('listbox')).to.have.attribute('aria-multiselectable', 'true');
});

it('should serialize multiple select display value', () => {
const { getByRole } = render(
<Select multiple value={[10, 20, 30]}>
Expand Down
1 change: 1 addition & 0 deletions packages/mui-material/src/Select/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
MenuListProps={{
'aria-labelledby': labelId,
role: 'listbox',
'aria-multiselectable': multiple ? 'true' : undefined,
disableListWrap: true,
...MenuProps.MenuListProps,
}}
Expand Down

0 comments on commit 5ae040f

Please sign in to comment.