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

Modify scrollbar check, stop static nav shift #13103

Closed
wants to merge 1 commit into from
Closed

Modify scrollbar check, stop static nav shift #13103

wants to merge 1 commit into from

Conversation

thcipriani
Copy link
Contributor

Tested working:

  • Debian 7/Iceweasel 17.0.10
  • Debian 7/Chrome 32.0.1700.107
  • Windows 7/IE 10
  • Windows 7/Chrome 33
  • OSX 10.9/Firefox 27.0.1

this.isShown = null
this.options = options
this.$body = $(document.body)
this.$fixedNavs = this.$body.children('.navbar-fixed-top, .navbar-fixed-bottom')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we'd have to add a bunch more special cases and/or support for the user adding their own special cases... 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two classes are the only ones I've really seen cause a problem as far as base bootstrap and this solution is concerned.

User special cases should be handled via the show.bs.modal event.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cvrebert do you think that the static-nav cases should handled elsewhere?

The change from inspecting window.innerHeight to checking window.innerWidth to denote the presence of scrollbars should fix the solution that's already out there while leaving the navbar-fixed-[whatever] alone (i.e., leaving them shifting right).

Would this pull request be better to just address the issue with IE10/11?

I'm really eager to see some fix roll so that I can update my own codebase.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this pull request be better to just address the issue with IE10/11?

that's just what i was going to ask.

The fixed problem is actually just a rendering bug with chrome (asfaik) – works fine in firefox, etc.

@cvrebert cvrebert added the js label Mar 17, 2014
@cvrebert cvrebert added this to the v3.2.0 milestone Mar 17, 2014
@fat
Copy link
Member

fat commented Mar 25, 2014

@thcipriani could you also squash your commits! thanks!

@thcipriani
Copy link
Contributor Author

@fat squashed and focused only on IE10/11

@fat
Copy link
Member

fat commented Mar 27, 2014

lgtm – thanks a lot

@cvrebert
Copy link
Collaborator

@fat So, we can merge this?

@fat
Copy link
Member

fat commented Mar 29, 2014

yep, looks good to me

@eugenzaharia
Copy link

Version 3.2.0 keeps shifting my body to left, so I end up commenting
this.$body.addClass('modal-open') this.setScrollbar()
within modals.js

@thcipriani
Copy link
Contributor Author

@eugenzaharia can you provide a jsfiddle micro example for what you're seeing, or, let me know if you're seeing it on http://getbootstrap.com/javascript/#modals

Also, can you provide your OS/Browser version combo for which you're having this issue.

Also, probably a good idea to open a new issue once you have those things to make management easier.

Thanks!

@ghost
Copy link

ghost commented Dec 26, 2014

Having the same problem with 3.2 using chrome. Fixed it via

body.modal-open {
    padding-right: 0px !important;
}

@Gwi7d31
Copy link

Gwi7d31 commented Dec 27, 2014

@whoknowsit. Nice job. Confirmed fix with FF 34.0.5 and Chrome 39.0.2171.95 m when scrollbar is forced into page. Bootstrap version 3.2.0

@ghost
Copy link

ghost commented Jan 4, 2015

Now, i use this:

body.modal-open, .modal-open .navbar-fixed-top, .modal-open .navbar-fixed-bottom {
    padding-right: 0px !important;
    overflow-y: auto;
}

@jjwilliams
Copy link

@whoknowsit thanks - your previous fix works for me (with the overflow-y:auto). Adding all the navbar classes causes my navbar to jump.

This is a pesky ass little bug.

body.modal-open {
padding-right: 0px !important;
overflow-y: auto;
}

Version 39.0.2171.65 Built on Ubuntu 14.04, running on LinuxMint 17.1 (64-bit)

@ghost
Copy link

ghost commented Jan 9, 2015

I guess, it depends on some factors, what's working and what not.

@twbs twbs locked and limited conversation to collaborators Feb 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open modal is shifting body content to the left
6 participants