forked from MapComplete/MapComplete
		
	Fix: don't throw an error if there is no parent element which can be scrolled
This commit is contained in:
		
							parent
							
								
									95c41d672e
								
							
						
					
					
						commit
						3166918551
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -1450,7 +1450,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be | ||||||
| 
 | 
 | ||||||
|     public static scrollIntoView(element: HTMLBaseElement | HTMLDivElement) { |     public static scrollIntoView(element: HTMLBaseElement | HTMLDivElement) { | ||||||
|         // Is the element completely in the view?
 |         // Is the element completely in the view?
 | ||||||
|         const parentRect = Utils.findParentWithScrolling(element).getBoundingClientRect() |         const parentRect = Utils.findParentWithScrolling(element)?.getBoundingClientRect() | ||||||
|  |         if(!parentRect){ | ||||||
|  |             return | ||||||
|  |         } | ||||||
|         const elementRect = element.getBoundingClientRect() |         const elementRect = element.getBoundingClientRect() | ||||||
| 
 | 
 | ||||||
|         // Check if the element is within the vertical bounds of the parent element
 |         // Check if the element is within the vertical bounds of the parent element
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue