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:
ThibG 2019-07-06 18:18:08 +02:00 committed by Eugen Rochko
부모 6abd849803
커밋 16f348431b
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제

파일 보기

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