When the modal is open, it is not ideal to keep vertical scrolling. Thats why in the useEffect of my component I did this:
if (state.modal) {
document.body.style.overflow = "hidden";
document.body.style.paddingRight = "17px";
}
return () => {
document.body.style.overflow = "unset";
document.body.style.paddingRight = "0px";
};
Although, it hides the scrollbar, now the problem is, the browser is moved because of scrollbar hiding and show.
so that, I want to keep the scroll bar but disable it when the modal is open.