Fix: don't throw an error if there is no parent element which can be scrolled

This commit is contained in:
Pieter Vander Vennet 2024-01-12 23:34:57 +01:00
parent 95c41d672e
commit 3166918551

View file

@ -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) {
// 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()
// Check if the element is within the vertical bounds of the parent element