Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal scrolls down the page #27176

Closed
ysds opened this issue Sep 4, 2018 · 8 comments
Closed

Modal scrolls down the page #27176

ysds opened this issue Sep 4, 2018 · 8 comments

Comments

@ysds
Copy link
Member

ysds commented Sep 4, 2018

The occurrence condition is not clear, but when open a modal, the page may scroll down. It appears to be affected by the window size or length of the page. Often it happens when the window size is small, it may occur even when the window is wide.

Windows 10 / macOS (Show scroll bars - always)
modal

https://getbootstrap.com/docs/4.1/components/modal/

@XhmikosR
Copy link
Member

I can't reproduce with Firefox on Windows 10.

@Johann-S
Copy link
Member

I wasn't able to reproduce it on macOS High Sierra with Firefox 61 (thanks to BrowserStack 😄)

@ysds
Copy link
Member Author

ysds commented Sep 10, 2018

I tested 4 browsers on Windows 10. It seems to happen only in Chrome.

IE11/Edge/Firefox/Chrome:
modal-scroll-down

@XhmikosR
Copy link
Member

Maybe try Chrome canary/beta etc and if it still happens then might be a good idea reporting it.

@Joyrex
Copy link

Joyrex commented Sep 19, 2018

Confirmed in latest Canary build (Version 71.0.3556.1 (Official Build) canary-dcheck (32-bit)) that it still happens.

@helmutgranda
Copy link
Contributor

helmutgranda commented Sep 25, 2018

When a scrollbar is present modal adds padding the size of the scrollbar (~15px), every browser is happy to oblige except Chrome...

Measurements are also correct between Chrome Canary/FireFox

bootstrap/js/src/modal.js

Lines 454 to 458 in 0350858

const actualPadding = document.body.style.paddingRight
const calculatedPadding = $(document.body).css('padding-right')
$(document.body)
.data('padding-right', actualPadding)
.css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`)

I went ahead and removed the dynamic padding added for testing purposes and in fact Chrome is happy with 0px padding applied to the body but now all the other browsers complain.

Still looking...

@JyotirmoyGoswami
Copy link

I am seeing another behaviour in iphone 5s chrome that the modal background gets scrolled when modal overlay is being scrolled. My believe that it happens in all ios phones.

ezgif com-video-to-gif

@ysds
Copy link
Member Author

ysds commented Nov 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants
@helmutgranda @XhmikosR @Joyrex @Johann-S @ysds @JyotirmoyGoswami and others