Skip to content

Commit

Permalink
Prevent scrolling up when opening a dialog (#29832)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtr authored Jan 3, 2019
1 parent 7a0b6cd commit 947fa04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 3 additions & 6 deletions client/components/dialog/dialog-base.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ class DialogBase extends Component {
appElement={ document.getElementById( 'wpcom' ) }
overlayClassName={ backdropClassName } // We use flex here which react-modal doesn't
className={ dialogClassName }
htmlOpenClassName="ReactModal__Html--open"
role="dialog"
shouldCloseOnEsc={ shouldCloseOnEsc }
>
<div
className={ classnames( this.props.className, contentClassName ) }
ref="content"
tabIndex="-1"
>
<div className={ classnames( this.props.className, contentClassName ) } tabIndex="-1">
{ this.props.children }
</div>
{ this._renderButtonsBar() }
Expand All @@ -80,7 +77,7 @@ class DialogBase extends Component {
}

return (
<div className={ buttonsClassName } ref="actionButtons">
<div className={ buttonsClassName }>
{ this.props.buttons.map( this._renderButton, this ) }
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions client/components/dialog/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@
.ReactModal__Body--open {
overflow: hidden;
}

.ReactModal__Html--open {
overflow: visible;
}

0 comments on commit 947fa04

Please sign in to comment.