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
6abd849803
commit
16f348431b
|
@ -117,9 +117,12 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
handleFocus = () => {
|
handleFocus = () => {
|
||||||
if (this.composeForm && !this.props.singleColumn) {
|
if (this.composeForm && !this.props.singleColumn) {
|
||||||
|
const { left, right } = this.composeForm.getBoundingClientRect();
|
||||||
|
if (left < 0 || right > (window.innerWidth || document.documentElement.clientWidth)) {
|
||||||
this.composeForm.scrollIntoView();
|
this.composeForm.scrollIntoView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
// This statement does several things:
|
// This statement does several things:
|
||||||
|
|
Loading…
Reference in New Issue