Skip to content

Commit

Permalink
ensure focus does not scroll the modal
Browse files Browse the repository at this point in the history
In IOS we found that the focus of an element would scroll the page so such element is brought into view.

In our case we have a grid of several views (iframes) and whenever a modal would appear on one of those views then the whole app would scroll to show the cell were the modal appeared, which is undesireable.

This PR fixes that.
  • Loading branch information
xaviergonz authored and diasbruno committed Apr 30, 2020
1 parent 9a4dde5 commit 206cfe6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default class ModalPortal extends Component {

// Don't steal focus from inner elements
focusContent = () =>
this.content && !this.contentHasFocus() && this.content.focus();
this.content && !this.contentHasFocus() && this.content.focus({ preventScroll: true });

closeWithTimeout = () => {
const closesAt = Date.now() + this.props.closeTimeoutMS;
Expand Down

0 comments on commit 206cfe6

Please sign in to comment.