The culprit is in renderChart(): it calls chart?.remove() which empties the

container div, causing the layout to collapse to zero height for a moment.
  The browser then scrolls to keep the viewport anchored, but since the page
  got shorter it jumps to the top. When the new SVG is appended, the page is
  taller again but the scroll position was already reset.

  Fix: give the chart container a min-height matching the chart height (220px)
  so it never collapses.
This commit is contained in:
Davide Scaini
2026-04-10 22:58:34 +02:00
parent bc30e0a2fc
commit c99b755382
+1 -1
View File
@@ -347,7 +347,7 @@
</div>
</div>
<div bind:this={chartEl} class="w-full overflow-hidden"></div>
<div bind:this={chartEl} class="w-full overflow-hidden" style="min-height:220px"></div>
<!-- Histogram controls (range + bins) -->
{#if chartType === 'histogram'}