Skip to content

Commit

Permalink
[fixed] container content no longer shifts when overflowing
Browse files Browse the repository at this point in the history
Incorporates upstream tbs logic to pad the container before hiding the
scrollbar with the `.modal-open` class

fixes react-bootstrap#354
  • Loading branch information
jquense committed Jun 13, 2015
1 parent 66f0f92 commit d18dadb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ const Modal = React.createClass({

this._containerIsOverflowing = container.scrollHeight > containerClientHeight(container, this);

this._originalPadding = container.style.paddingRight;

if (this._containerIsOverflowing) {
container.style.paddingRight = parseInt(this._originalPadding || 0, 10) + scrollbarSize + 'px';
}

if (this.props.backdrop) {
this.iosClickHack();
}
Expand Down Expand Up @@ -237,6 +243,8 @@ const Modal = React.createClass({

let container = getContainer(this);

container.style.paddingRight = this._originalPadding;

container.className = container.className.replace(/ ?modal-open/, '');

this.restoreLastFocus();
Expand Down

0 comments on commit d18dadb

Please sign in to comment.