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

Sticky navbar with container being shifted slightly to the left upon modal opened #23661

Closed
vtenfys opened this issue Aug 24, 2017 · 1 comment

Comments

@vtenfys
Copy link

vtenfys commented Aug 24, 2017

Link to demo: https://jsfiddle.net/techdavid/g89ts0rs/1/

When opening a modal, where the page contains a sticky navbar with a container inside it, the container gets shifted slightly to the left due to the padding being applied to the body element.

The .sticky-top element gets a right-padding of 33px added, however there is also white space to the right of this due to the padding on the body. The .sticky-top element should also have a margin-right of -33px applied to compensate for this.

I think that when PR #18441 was submitted, it maybe wasn't tested with .sticky-top (only .fixed-top) and so this is why the problem is still sometimes occurring. I checked the source of the JS file I'm using and found that it does contain code from this PR.

Edit: checked to confirm the problem is only occurring with sticky-top (not fixed-top).


Before opening an issue:

When asking general "how to" questions:

When reporting a bug, include:

When suggesting a feature, include:

  • As much detail as possible for what we should add and why it's important to Bootstrap
  • Relevant links to prior art, screenshots, or live demos whenever possible
@vtenfys vtenfys changed the title Fixed navbar with container being shifted slightly to the left upon modal opened Sticky navbar with container being shifted slightly to the left upon modal opened Aug 24, 2017
@vtenfys
Copy link
Author

vtenfys commented Aug 24, 2017

The modal is also shifting position to the left slightly whenever the viewport size changes (e.g. in the jsfiddle, adjust the CSS / preview height).

Edit: moved to a separate issue as #23672

vtenfys pushed a commit to vtenfys/bootstrap that referenced this issue Aug 25, 2017
Previously white space was visible to the right of sticky elements due to right padding being added to the body. This fixes twbs#23661.
Johann-S pushed a commit that referenced this issue Aug 25, 2017
* Adjust margin for sticky elements on modal

Previously white space was visible to the right of sticky elements due to right padding being added to the body. This fixes #23661.

* Add unit tests for margin of sticky elements on modal
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

2 participants