[Glitch] Only scroll to the compose form if it's not horizontally in the viewport
Port 64909cf0d9 to glitch-soc
			
			
This commit is contained in:
		
							parent
							
								
									73051a4c10
								
							
						
					
					
						commit
						e2c93b4b34
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -197,7 +197,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 a new issue