mui / material-ui

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

[Autocomplete] Use `ul` element for the listbox #44422

Closed DiegoAndai closed 6 days ago

DiegoAndai commented 1 week ago

Closes https://github.com/mui/material-ui/issues/44264

Explanation

The ul element was lost in this PR: https://github.com/mui/material-ui/pull/43994. Previously, it was provided via the as prop:

https://github.com/mui/material-ui/blob/15ea548de803e4602894cae6304a497d7ddaf09c/packages/mui-material/src/Autocomplete/Autocomplete.js#L560-L561

https://github.com/mui/material-ui/blob/15ea548de803e4602894cae6304a497d7ddaf09c/packages/mui-material/src/Autocomplete/Autocomplete.js#L685

But after https://github.com/mui/material-ui/pull/43994 fix, we failed to maintain it:

https://github.com/mui/material-ui/blob/01c5f344628bc66e16f86284ee0fc7107002a5ca/packages/mui-material/src/Autocomplete/Autocomplete.js#L329

https://github.com/mui/material-ui/blob/01c5f344628bc66e16f86284ee0fc7107002a5ca/packages/mui-material/src/Autocomplete/Autocomplete.js#L559-L560

https://github.com/mui/material-ui/blob/01c5f344628bc66e16f86284ee0fc7107002a5ca/packages/mui-material/src/Autocomplete/Autocomplete.js#L686

Solution

This PR brings it back by setting AutocompleteListbox's element to ul, and adds a test for it.

v5: https://codesandbox.io/p/sandbox/pr-44422-v5-x2ff5z Before: https://codesandbox.io/p/sandbox/pr-44422-before-l66t9p After: https://codesandbox.io/p/sandbox/pr-44422-after-cx66k3

mui-bot commented 1 week ago

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad) Details of bundle changes

Generated by :no_entry_sign: dangerJS against 0d2d298b27659451d80c14c1cecad0851cac5e26

rathpc commented 3 days ago

@aarongarciah any idea when this will be part of a release (6.1.8 perhaps?)

aarongarciah commented 3 days ago

@rathpc we'll probably release 6.2.0 this week and it'll contain this change.

rathpc commented 3 days ago

@rathpc we'll probably release 6.2.0 this week and it'll contain this change.

Perfect, thank you for the fast reply!!

ArmandRedgate commented 1 day ago

A related issue that may conflict with this:

https://github.com/mui/material-ui/issues/42782