mirror of
https://github.com/whippyshou/mastodon
synced 2024-11-28 14:58:31 +09:00
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.
This commit is contained in:
parent
ae003d54f9
commit
c07cca4727
@ -117,7 +117,10 @@ class ComposeForm extends ImmutablePureComponent {
|
|||||||
|
|
||||||
handleFocus = () => {
|
handleFocus = () => {
|
||||||
if (this.composeForm && !this.props.singleColumn) {
|
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…
Reference in New Issue
Block a user