File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
src/shared/components/Modal Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -156,14 +156,19 @@ export const Modal = ({
156156
157157 // 배경 스크롤 방지 (modal variant만)
158158 const originalOverflow = document . body . style . overflow ;
159+ const originalPaddingRight = document . body . style . paddingRight ;
159160 if ( variant === 'modal' ) {
161+ // 스크롤바 너비 계산
162+ const scrollbarWidth = window . innerWidth - document . documentElement . clientWidth ;
160163 document . body . style . overflow = 'hidden' ;
164+ document . body . style . paddingRight = `${ scrollbarWidth } px` ;
161165 }
162166
163167 return ( ) => {
164168 document . removeEventListener ( 'keydown' , handleKeyDown ) ;
165169 if ( variant === 'modal' ) {
166170 document . body . style . overflow = originalOverflow ;
171+ document . body . style . paddingRight = originalPaddingRight ;
167172 }
168173 } ;
169174 }
You can’t perform that action at this time.
0 commit comments