Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Select] Set aria-expanded to false when listbox is collapsed #25545

Merged
merged 2 commits into from Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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-expanded="false" if the listbox isnt displayed', () => {
eps1lon marked this conversation as resolved.
Show resolved Hide resolved
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