This PR does two things to improve the modal behavior:
Firstly it enables preserveScrollBarGap, this is supposed to be enabled by default in Chakra according to the documentation, but isn't. This prevents the page jumping around when modals are opened.
Secondly it patches @chakra-ui/focus-lock to prevent scrolling when returning focus (e.g. when closing a modal). Chakra uses react-focus-lock under the hood which supports not scrolling, but this functionality is not currently supported in Chakra.
This PR does two things to improve the modal behavior:
preserveScrollBarGap
, this is supposed to be enabled by default in Chakra according to the documentation, but isn't. This prevents the page jumping around when modals are opened.@chakra-ui/focus-lock
to prevent scrolling when returning focus (e.g. when closing a modal). Chakra usesreact-focus-lock
under the hood which supports not scrolling, but this functionality is not currently supported in Chakra.