[list] Fix List sticky subheader overlapping iOS scrollbar#48375
Conversation
…pping iOS scrollbar Fixes mui#44569 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deploy previewhttps://deploy-preview-48375--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
| margin: 0, | ||
| padding: 0, | ||
| position: 'relative', | ||
| isolation: 'isolate', |
There was a problem hiding this comment.
Seems to fix the issue, but better to apply this only in the sticky subheader use-case and not unconditionally to the root styles since a number of other components use List internally
There was a problem hiding this comment.
Good point — moved isolation: 'isolate' into the subheader variant so it only applies when a sticky ListSubheader is in use. Updated in the latest commit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Albert Yu <albert@albertyu.co>
mj12albert
left a comment
There was a problem hiding this comment.
Thanks for the PR @sandeshdamkondwar
|
I had someone look at this. I see this as an opportunity to set a target for how far we should push things. Here:
Screen.Recording.2026-05-02.at.19.15.21.mov
https://mui.com/material-ui/react-table/#sticky-header
https://mui.com/material-ui/react-autocomplete/#grouped
diff --git a/packages/mui-material/src/Autocomplete/Autocomplete.js b/packages/mui-material/src/Autocomplete/Autocomplete.js
index 28f490861e..02a9a462d9 100644
--- a/packages/mui-material/src/Autocomplete/Autocomplete.js
+++ b/packages/mui-material/src/Autocomplete/Autocomplete.js
@@ -332,7 +332,6 @@ const AutocompleteListbox = styled('ul', {
padding: '8px 0',
maxHeight: '40vh',
overflow: 'auto',
- isolation: 'isolate', // Prevent overlap with iOS overlay scrollbars.
position: 'relative',
[`& .${autocompleteClasses.option}`]: {
minHeight: 48,
@@ -398,6 +397,8 @@ const AutocompleteGroupLabel = styled(ListSubheader, {
memoTheme(({ theme }) => ({
backgroundColor: (theme.vars || theme).palette.background.paper,
top: -8,
+ margin: '0 0.5rem 0 0',
+ width: 'calc(100% - 0.5rem)',
})),
);
diff --git a/packages/mui-material/src/List/List.js b/packages/mui-material/src/List/List.js
index 3e885b9208..7e09c8ae81 100644
--- a/packages/mui-material/src/List/List.js
+++ b/packages/mui-material/src/List/List.js
@@ -48,7 +48,6 @@ const ListRoot = styled('ul', {
props: ({ ownerState }) => ownerState.subheader,
style: {
paddingTop: 0,
- isolation: 'isolate', // Prevent overlap with iOS overlay scrollbars.
},
},
],
diff --git a/packages/mui-material/src/ListSubheader/ListSubheader.js b/packages/mui-material/src/ListSubheader/ListSubheader.js
index 36bd386589..596b8839c7 100644
--- a/packages/mui-material/src/ListSubheader/ListSubheader.js
+++ b/packages/mui-material/src/ListSubheader/ListSubheader.js
@@ -85,6 +85,8 @@ const ListSubheaderRoot = styled('li', {
top: 0,
zIndex: 1,
backgroundColor: (theme.vars || theme).palette.background.paper,
+ margin: '0 0.5rem 0 0',
+ width: 'calc(100% - 0.5rem)',
},
},
], |


Preview: https://deploy-preview-48375--material-ui.netlify.app/material-ui/react-list/
Summary
Closes #44569
On iOS, the sticky
ListSubheaderhaszIndex: 1which causes it to appear above the browser's overlay scrollbar indicator. Addingisolation: 'isolate'creates a new stacking context that contains the subheader's z-index, preventing it from leaking out and overlapping the scrollbar.Per reviewer feedback, the fix is now scoped to the
subheadervariant (i.e. when thesubheaderprop is set onList) rather than applied unconditionally, so components that useListinternally (e.g.Select,Menu,Autocomplete) are not affected.Patterns covered
<List subheader={<ListSubheader>...</ListSubheader>}><List subheader={<li />}>withListSubheaderas a nested child<List><ListSubheader>...</ListSubheader></List>(no subheader prop)sx={{ isolation: 'isolate' }}toListIf it's preferable to also fix the direct-child case without impacting internal usages, one option is to unconditionally apply
isolation: 'isolate'since it is effectively a no-op when no stickyz-indexchildren are present — happy to go that route if preferred.Test plan
Listwith thesubheaderprop set to a stickyListSubheaderon iOS (or Safari with a visible scrollbar) — scrollbar should appear above the subheaderSelect,Menu, andAutocompletedropdowns are visually unaffected🤖 Generated with Claude Code