mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.52k stars 32.19k forks source link

[material-ui][Select] Aria-controls references invalid id when not expanded #43876

Open siddhantantil39 opened 1 week ago

siddhantantil39 commented 1 week ago

Steps to reproduce

Aria-controls references invalid id when not expanded mui select component select-error

Link to live example: (required) Go to: https://mui.com/material-ui/react-select/

Steps:

  1. Download ARC Toolkit: https://chromewebstore.google.com/detail/arc-toolkit/chdkkkccnlfncngelccgbgfmjebmkmce?hl=en and install it
  2. Expand Inspect and select ARC Toolkit and Run tests on https://mui.com/material-ui/react-select/
  3. Look into the error for "ARIA attribute value is incorrect Description: The value :R9alal9h9l6kud6: is not allowed on the aria-controls attribute(s)."

It is also observed using access-assistant also.

PFA the ARC snapshot:

Current behavior

ARIA attribute value is incorrect is observed on the select component upon ADA Testing using automation tools such as ARC.

Expected behavior

Aria-control should refer to the id of the menu-item, in non-expanded state also.

Context

No response

Your environment

No response

Search keywords: select

DiegoAndai commented 2 days ago

Thanks for the report @siddhantantil39!

@michaldudak, do you know what's the behaviour on Base UI's Select regarding this?

michaldudak commented 1 day ago

AFAIR @mui/base did not place the aria-controls attribute when its target doesn't exist. @atomiks, how does the new implementation handle this case?

atomiks commented 1 day ago

@michaldudak yes, aria-controls is not added to the trigger unless the popup is in the open state

DiegoAndai commented 17 hours ago

@michaldudak @atomiks, thanks. This means this will be fixed when we refactor Material UI's Select on top of Base UI's. This is one of the next projects we'll take on soon.