In detail pages, there are interactions between the sections being viewed (presentation, practical information, report, etc.) and other parts of the page, such as the map or the anchor menu.
To handle these interactions, the position and height of each section are calculated several times (when scrolling and resizing the window) to determine which section is currently being viewed and which is not. As a result of asynchronous changes in section heights (lazy image loading, widget taking a while to load, etc.), the calculation can fail and triggering accuracy is poorer.
The whole calculation process is a bit artisanal, and we should remedy this by using the dedicated intersection observer API (currently used by geotrek rando widget).
In detail pages, there are interactions between the sections being viewed (presentation, practical information, report, etc.) and other parts of the page, such as the map or the anchor menu.
To handle these interactions, the position and height of each section are calculated several times (when scrolling and resizing the window) to determine which section is currently being viewed and which is not. As a result of asynchronous changes in section heights (lazy image loading, widget taking a while to load, etc.), the calculation can fail and triggering accuracy is poorer.
The whole calculation process is a bit artisanal, and we should remedy this by using the dedicated intersection observer API (currently used by geotrek rando widget).