Skip to content

Commit 3ce5fe4

Browse files
Fix resize event listener target in useTocHighlight
1 parent db4c455 commit 3ce5fe4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/components/Layout/useTocHighlight.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function useTocHighlight() {
6969
}
7070

7171
document.addEventListener('scroll', throttledUpdateActiveLink);
72-
document.addEventListener('resize', throttledUpdateActiveLink);
72+
window.addEventListener('resize', throttledUpdateActiveLink);
7373

7474
updateActiveLink();
7575

@@ -79,7 +79,7 @@ export function useTocHighlight() {
7979
timeoutRef.current = null;
8080
}
8181
document.removeEventListener('scroll', throttledUpdateActiveLink);
82-
document.removeEventListener('resize', throttledUpdateActiveLink);
82+
window.removeEventListener('resize', throttledUpdateActiveLink);
8383
};
8484
}, []);
8585

0 commit comments

Comments
 (0)