gearheads
/
mastodon
Archived
2
0
Fork 0

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.
gh/stable
ThibG 2019-07-06 18:18:08 +02:00 committed by Eugen Rochko
parent ae003d54f9
commit c07cca4727
1 changed files with 4 additions and 1 deletions

View File

@ -117,9 +117,12 @@ class ComposeForm extends ImmutablePureComponent {
handleFocus = () => {
if (this.composeForm && !this.props.singleColumn) {
const { left, right } = this.composeForm.getBoundingClientRect();
if (left < 0 || right > (window.innerWidth || document.documentElement.clientWidth)) {
this.composeForm.scrollIntoView();
}
}
}
componentDidUpdate (prevProps) {
// This statement does several things: