Skip to content

Commit

Permalink
Fixed the infinite Dialog Content max-height toggling
Browse files Browse the repository at this point in the history
It should ave been scrollHeight instead of height for an equality check.
  • Loading branch information
mlaursen committed Nov 9, 2017
1 parent d7a20a7 commit 2ccce1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/js/Dialogs/Dialog.js
Expand Up @@ -353,7 +353,7 @@ export default class Dialog extends PureComponent {
}
};

_handleContentResize = ({ height, el: content }) => {
_handleContentResize = ({ scrollHeight, el: content }) => {
const maxHeight = content.style.maxHeight;
const dialog = content.parentNode;
content.style.maxHeight = 'none';
Expand All @@ -362,7 +362,7 @@ export default class Dialog extends PureComponent {

const totalHeight = dialog.offsetHeight - (title ? title.offsetHeight : 0) - (footer ? footer.offsetHeight : 0);
content.style.maxHeight = maxHeight;
const equalHeight = totalHeight === height;
const equalHeight = totalHeight === scrollHeight;
if (equalHeight) {
if (this.state.contentStyles && this.state.contentStyles.maxHeight) {
this.setState({ contentStyles: this.props.contentStyle });
Expand Down

0 comments on commit 2ccce1a

Please sign in to comment.