forked from treehouse/mastodon
[Glitch] Only scroll to the compose form if it's not horizontally in the viewport
Port c07cca4727
to glitch-soc
signup-info-prompt
parent
a0b614f10a
commit
64f3bc77ac
|
@ -197,9 +197,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This statement does several things:
|
// This statement does several things:
|
||||||
// - If we're beginning a reply, and,
|
// - If we're beginning a reply, and,
|
||||||
|
|
Loading…
Reference in New Issue