@@ -116,7 +116,6 @@ class Modal extends React.Component {
116
116
117
117
this . _element = null ;
118
118
this . _originalBodyPadding = null ;
119
- this . _originalBodyOverflow = null ;
120
119
this . getFocusableChildren = this . getFocusableChildren . bind ( this ) ;
121
120
this . handleBackdropClick = this . handleBackdropClick . bind ( this ) ;
122
121
this . handleBackdropMouseDown = this . handleBackdropMouseDown . bind ( this ) ;
@@ -371,9 +370,11 @@ class Modal extends React.Component {
371
370
}
372
371
373
372
this . _originalBodyPadding = getOriginalBodyPadding ( ) ;
374
- this . _originalBodyOverflow = window . getComputedStyle (
375
- document . body ,
376
- ) . overflow ;
373
+ if ( Modal . openCount < 1 ) {
374
+ Modal . originalBodyOverflow = window . getComputedStyle (
375
+ document . body ,
376
+ ) . overflow ;
377
+ } ;
377
378
conditionallyUpdateScrollbar ( ) ;
378
379
379
380
if ( Modal . openCount === 0 ) {
@@ -419,7 +420,7 @@ class Modal extends React.Component {
419
420
document . body . className = document . body . className
420
421
. replace ( modalOpenClassNameRegex , ' ' )
421
422
. trim ( ) ;
422
- document . body . style . overflow = this . _originalBodyOverflow ;
423
+ document . body . style . overflow = Modal . originalBodyOverflow ;
423
424
}
424
425
this . manageFocusAfterClose ( ) ;
425
426
Modal . openCount = Math . max ( 0 , Modal . openCount - 1 ) ;
@@ -571,5 +572,6 @@ class Modal extends React.Component {
571
572
Modal . propTypes = propTypes ;
572
573
Modal . defaultProps = defaultProps ;
573
574
Modal . openCount = 0 ;
575
+ Modal . originalBodyOverflow = null ;
574
576
575
577
export default Modal ;
0 commit comments