[Glitch] Fix scrolling issues when closing some dropdown menus
Port b4d2063384 to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
			
			
This commit is contained in:
		
							parent
							
								
									37e746eab6
								
							
						
					
					
						commit
						b11521e251
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		|  | @ -205,7 +205,7 @@ export default class Dropdown extends React.PureComponent { | |||
| 
 | ||||
|   handleClose = () => { | ||||
|     if (this.activeElement) { | ||||
|       this.activeElement.focus(); | ||||
|       this.activeElement.focus({ preventScroll: true }); | ||||
|       this.activeElement = null; | ||||
|     } | ||||
|     this.props.onClose(this.state.id); | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent { | |||
|     } else { | ||||
|       const { top } = target.getBoundingClientRect(); | ||||
|       if (this.state.open && this.activeElement) { | ||||
|         this.activeElement.focus(); | ||||
|         this.activeElement.focus({ preventScroll: true }); | ||||
|       } | ||||
|       this.setState({ placement: top * 2 < innerHeight ? 'bottom' : 'top' }); | ||||
|       this.setState({ open: !this.state.open, openedViaKeyboard: type !== 'click' }); | ||||
|  | @ -100,7 +100,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent { | |||
| 
 | ||||
|   handleClose = () => { | ||||
|     if (this.state.open && this.activeElement) { | ||||
|       this.activeElement.focus(); | ||||
|       this.activeElement.focus({ preventScroll: true }); | ||||
|     } | ||||
|     this.setState({ open: false }); | ||||
|   } | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue