Skip to content

Commit 9f0cd15

Browse files
committed
fix(scanner): scroll to results section instead of page top on history click
- replaced window.scrollTo({ top: 0 }) with scrollIntoView on .results-section - uses requestAnimationFrame to wait for svelte to render the conditional block
1 parent e9ccf27 commit 9f0cd15

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib/components/scoring/ScanHistory.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@
2929
3030
function handleLoadEntry(entry: ScanHistoryEntry) {
3131
scoresStore.loadFromHistory(entry);
32-
// scroll to top so user sees the dashboard
33-
window.scrollTo({ top: 0, behavior: 'smooth' });
32+
// wait for the results section to render, then scroll to it
33+
requestAnimationFrame(() => {
34+
document
35+
.querySelector('.results-section')
36+
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
37+
});
3438
}
3539
3640
function handleClear() {

0 commit comments

Comments
 (0)