Browse Source

Only scroll to the compose form if it's not horizontally in the viewport (#11246)

Avoids jumping the scroll around vertically when giving it focus and
editing long toots.
pull/4/head
ThibG 4 years ago
committed by Eugen Rochko
parent
commit
c07cca4727
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      app/javascript/mastodon/features/compose/components/compose_form.js

+ 4
- 1
app/javascript/mastodon/features/compose/components/compose_form.js View File

@ -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();
}
}
}

Loading…
Cancel
Save