I want to have a material-ui listitem with has sticky subheaders. I managed to get this sticky, but the subheader is overlapping with the items when scrolling:
How to prevent this? Full code:
<List
{...rest}
className={clsx(classes.root, className)}
subheader={<li />}
>
{pages.map(group => (
<li>
<ul className={classes.ul}>
{group.groupname && <><Divider /><ListSubheader>{group.groupname}</ListSubheader></> }
{group.routes.map(page => (
<div key={page.title}>
{page.children ?
<>
<ListItem
className={classes.item}
disableGutters
key={page.title}
>
{page.title}
</ListItem>
<Collapse in={state[page.title] ? true : false} timeout="auto" unmountOnExit>
<List component="div" disablePadding>
{page.children.map(childpage => (
<ListItem
className={classes.nested}
disableGutters
key={childpage.title}
>
{childpage.title}
</ListItem>
))}
</List>
</Collapse>
</>
:
<ListItem
className={classes.item}
disableGutters
key={page.title}
>
{page.title}
</ListItem>
}
</div>
))}
</ul>
</li>
))}
</List>
I expanded the example from the material-ui website

Currently having the exact same problem, with the addition of not being able to scroll to the bottom of my navbar whenever the list is fully extended:
I came up with a temporary solution, but I was unable to get the sticky feature of the subheader items to function without it overlapping with the content of the menu when scrolling.
For the overlapping issue, set
disableSticky={true}on each of your ListSubheader elements. This should fix your specific issue.My scrolling issue was caused by a
top: 60I had set increateMuiThemeTo fix this I simply replaced top with padding: