I'm trying to do input field which opens up menu when it's focused. Menu opens up just fine but input field loses focus and all custom styling when menu is visible. Any ideas how to keep focus on input while menu is visible at same time?
Here is my handler:
const [anchorElSearch, setAnchorElSearch] = React.useState(null);
const handleClickSearch = (event) => {
setAnchorElSearch(event.currentTarget);
};
Here is my Input field and Menu components:
<Input
className={classes.searchInput}
classes={{ focused: classes.searchInputFocused }}
aria-controls="searchMenu"
aria-haspopup="true"
onClick={handleClickSearch}
/>
<Menu
id="searchMenu"
anchorEl={anchorElSearch}
keepMounted
open={Boolean(anchorElSearch)}
>
<MenuItem onClick={handleCloseSearch}>Works</MenuItem>
</Menu>