Skip to content

Commit 19f3792

Browse files
committed
feat(output): highlights jump to their section with orientation
1 parent 2b6e374 commit 19f3792

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

output-tab.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,12 @@ function renderHighlights(d) {
812812
}
813813

814814
host.querySelectorAll('.hl-row.clickable').forEach(row => {
815-
row.addEventListener('click', () => show(Number(row.dataset.jump)));
815+
row.addEventListener('click', () => {
816+
const n = Number(row.dataset.jump);
817+
show(n);
818+
const behavior = matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth';
819+
document.getElementById('t' + n)?.scrollIntoView({ behavior, block: 'start' });
820+
});
816821
});
817822
}
818823

0 commit comments

Comments
 (0)