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

Fix modal scrolling for overflow #5578

Conversation

lulalala
Copy link

When modal contains absolute positioned element which is taller than available screen, the modal scrolling is not triggered. By using scrollHeight the extended height is taken into account.

scrollHeight is how Bootstrap modal determines whether to trigger scrolling.

The bug demo:
https://jsfiddle.net/lulalala/ngjvzwkc/1/

When modal contains absolute positioned element which is taller than available screen,
the modal scrolling is not triggered.
By using `scrollHeight` the extended height is taken into account.
@jlukic jlukic added this to the 2.2.12 milestone Aug 7, 2017
@jlukic
Copy link
Member

jlukic commented Aug 7, 2017

The fix above doesnt work for a few reasons

  • When sizes are calculated the modal has display: none;
  • Height calculation is used for vertical centering, and offscreen calculation is based on relative position of modal centering
  • Modifying modal height to use scrollHeight would change the centering

7450aa3 adds a new loading state for calculating height, and uses both heights together. If scrollHeight is larger than modal base height, it'll use scrollHeight to calculate whether the modal is off stage.

@jlukic jlukic closed this in 7450aa3 Aug 7, 2017
@lulalala lulalala deleted the fix-modal-scrolling-with-extended-element branch August 7, 2017 15:22
@lulalala
Copy link
Author

lulalala commented Aug 7, 2017

thanks for the fix!

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

Successfully merging this pull request may close these issues.

2 participants