From d18dadbf9e37063655e1ec3f957bb4cb97a2b02e Mon Sep 17 00:00:00 2001 From: jquense Date: Wed, 10 Jun 2015 15:01:11 -0400 Subject: [PATCH] [fixed] container content no longer shifts when overflowing Incorporates upstream tbs logic to pad the container before hiding the scrollbar with the `.modal-open` class fixes #354 --- src/Modal.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Modal.js b/src/Modal.js index 2f5ade2f84..dcc2d0fb97 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -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(); } @@ -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();