[material-ui][TextField] When as a Select, it shows an empty menu when items get removed dynamically #42350
Labels
component: text field
This is the name of the generic UI component, not the React module!
package: material-ui
Specific to @mui/material
status: waiting for author
Issue with insufficient information
Steps to reproduce
Link to live example: https://playcode.io/1881049
Steps:
Mock API
button. This will mock a real API call, setting theisLoading
state true.Loading...
text.Code
Demo
Screen.Recording.2024-05-23.at.12.58.30.PM.mp4
Current behavior
The dropdown does not disappear after the list items become empty.
Upon inspection, it was discovered that the DOM retained the
ul
element even after the list items were removed.Expected behavior
With the removal of all the list items, the dropdown list shown also disappear. Technically, it should clear the
ul
element from the DOM.Context
The aim is to show the dropdown in a loading state until the API gets loaded. If there is not data, then the dropdown should become empty.
Your environment
npx @mui/envinfo
Browser
Google Chome
Version 124.0.6367.210 (Official Build) (arm64)
Search keywords: textfield, select, empty, menu, dropdown
The text was updated successfully, but these errors were encountered: