Skip to content

Lock background scroll while modals are open#1244

Merged
microbit-matt-hillsdon merged 1 commit into
mainfrom
modal-scroll-lock
Jun 26, 2026
Merged

Lock background scroll while modals are open#1244
microbit-matt-hillsdon merged 1 commit into
mainfrom
modal-scroll-lock

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator

Chakra 2.9 flipped the Modal preserveScrollBarGap default to true (chakra-ui/chakra-ui#8222), which maps to react-remove-scroll's removeScrollBar=false. That drops the body overflow:hidden lock, leaving the page scrollbar live and draggable behind the modal overlay. Set preserveScrollBarGap={false} on every Modal/Drawer/AlertDialog to restore the pre-2.10 hard scroll lock.

Chakra 2.9 flipped the Modal preserveScrollBarGap default to true
(chakra-ui/chakra-ui#8222), which maps to react-remove-scroll's
removeScrollBar=false. That drops the body overflow:hidden lock, leaving
the page scrollbar live and draggable behind the modal overlay. Set
preserveScrollBarGap={false} on every Modal/Drawer/AlertDialog to restore
the pre-2.10 hard scroll lock.
@github-actions

Copy link
Copy Markdown

@microbit-grace microbit-grace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@microbit-matt-hillsdon microbit-matt-hillsdon merged commit 099d6b7 into main Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants