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:
@@ -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'}
|
||||
|
||||
Reference in New Issue
Block a user