I'm facing a challenge in setting up a lengthy list of Menu Items on a Select control that incorporates sticky SubHeaders. The issue arises when the items scroll, as they end up obstructing the subheaders.
To tackle this problem, I examined the Material UI examples of grouped Select items as a reference point. My goal is to achieve a similar behavior to the Material UI example featuring pinned subHeader Lists.
You can find a working example on codeSandbox showcasing what I've been attempting.
Below is a snippet from my code:
<Select
className={classes.root}
MenuProps={{ className: classes.menu }}
value="Pick one"
onChange={e => {}}
>
{subHeaders.map(header => (
<li key={header}>
<ul>
<ListSubheader>{header}</ListSubheader>
{items.map(item => (
<MenuItem key={item} value={item}>
{item}
</MenuItem>
))}
</ul>
</li>
))}
</Select>
This snapshot depicts the issue faced: