Skip to content

Commit

Permalink
[Select] Set aria-expanded to false when listbox is collapsed (#25545)
Browse files Browse the repository at this point in the history
  • Loading branch information
Harish Karthik committed Mar 30, 2021
1 parent 830c18b commit 7f0b590
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/material-ui/src/Select/Select.test.js
Expand Up @@ -402,10 +402,10 @@ describe('<Select />', () => {
expect(getByRole('button', { hidden: true })).to.have.attribute('aria-expanded', 'true');
});

specify('aria-expanded is not present if the listbox isnt displayed', () => {
specify('ARIA 1.2: aria-expanded="false" if the listbox isnt displayed', () => {
const { getByRole } = render(<Select value="" />);

expect(getByRole('button')).not.to.have.attribute('aria-expanded');
expect(getByRole('button')).to.have.attribute('aria-expanded', 'false');
});

it('sets aria-disabled="true" when component is disabled', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Select/SelectInput.js
Expand Up @@ -369,7 +369,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
tabIndex={tabIndex}
role="button"
aria-disabled={disabled ? 'true' : undefined}
aria-expanded={open ? 'true' : undefined}
aria-expanded={open ? 'true' : 'false'}
aria-haspopup="listbox"
aria-label={ariaLabel}
aria-labelledby={[labelId, buttonId].filter(Boolean).join(' ') || undefined}
Expand Down

0 comments on commit 7f0b590

Please sign in to comment.