When my modal popup appears on screen, I am using the CSS property overflow: hidden
to eliminate the scrollbar.
To ensure that the screen does not shift when the scrollbar disappears, I am calculating the scrollbar width using JavaScript and adding padding dynamically. Here's an example:
<div className='site-layout-wrapper' style={{'padding-right': modal ? `${scrollbarWidth}px` : '0'}}>
However, I am facing a problem with a slight shift when the scrollbar reappears. How can I solve this issue?