Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only scroll to the compose form if it's not horizontally in the viewp…
…ort (#11246)

Avoids jumping the scroll around vertically when giving it focus and
editing long toots.
  • Loading branch information
ClearlyClaire authored and Gargron committed Jul 6, 2019
1 parent ae003d5 commit c07cca4
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -117,7 +117,10 @@ class ComposeForm extends ImmutablePureComponent {

handleFocus = () => {
if (this.composeForm && !this.props.singleColumn) {
this.composeForm.scrollIntoView();
const { left, right } = this.composeForm.getBoundingClientRect();
if (left < 0 || right > (window.innerWidth || document.documentElement.clientWidth)) {
this.composeForm.scrollIntoView();
}
}
}

Expand Down

0 comments on commit c07cca4

Please sign in to comment.