From 296d8b6e6e9074d8d913344d4f5a55924909377a Mon Sep 17 00:00:00 2001 From: Levi Thomason Date: Sat, 30 Sep 2017 14:29:10 -0700 Subject: [PATCH] fix(Modal): add/remove dimmer classes properly --- src/modules/Modal/Modal.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/modules/Modal/Modal.js b/src/modules/Modal/Modal.js index 6fe6389644..5d85bc9810 100644 --- a/src/modules/Modal/Modal.js +++ b/src/modules/Modal/Modal.js @@ -229,24 +229,20 @@ class Modal extends Component { handleRef = c => (this.ref = c) setPositionAndClassNames = () => { + const { dimmer } = this.props + const mountNode = this.getMountNode() - if (this.ref) { - const { dimmer } = this.props - const mountNode = this.getMountNode() - const { height } = this.ref.getBoundingClientRect() - - if (dimmer) { - mountNode.classList.add('dimmable') - mountNode.classList.add('dimmed') + if (dimmer) { + mountNode.classList.add('dimmable') + mountNode.classList.add('dimmed') - if (dimmer === 'blurring') { - mountNode.classList.add('blurring') - } - } else { - mountNode.classList.add('dimmable') - mountNode.classList.add('dimmed') + if (dimmer === 'blurring') { mountNode.classList.add('blurring') } + } + + if (this.ref) { + const { height } = this.ref.getBoundingClientRect() const marginTop = -Math.round(height / 2) const scrolling = height >= window.innerHeight