File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -238,12 +238,25 @@ class Modal {
238
238
return
239
239
}
240
240
241
+ const isModalOverflowing = this . _element . scrollHeight > document . documentElement . clientHeight
242
+
243
+ if ( ! isModalOverflowing ) {
244
+ this . _element . style . overflowY = 'hidden'
245
+ }
246
+
241
247
this . _element . classList . add ( CLASS_NAME_STATIC )
242
248
243
- const modalTransitionDuration = Util . getTransitionDurationFromElement ( this . _element )
249
+ const modalTransitionDuration = Util . getTransitionDurationFromElement ( this . _dialog )
250
+ $ ( this . _element ) . off ( Util . TRANSITION_END )
244
251
245
252
$ ( this . _element ) . one ( Util . TRANSITION_END , ( ) => {
246
253
this . _element . classList . remove ( CLASS_NAME_STATIC )
254
+ if ( ! isModalOverflowing ) {
255
+ $ ( this . _element ) . one ( Util . TRANSITION_END , ( ) => {
256
+ this . _element . style . overflowY = ''
257
+ } )
258
+ . emulateTransitionEnd ( this . _element , modalTransitionDuration )
259
+ }
247
260
} )
248
261
. emulateTransitionEnd ( modalTransitionDuration )
249
262
this . _element . focus ( )
You can’t perform that action at this time.
0 commit comments