From 3ce5fe49b7f0daddf2fde83537406783681cb233 Mon Sep 17 00:00:00 2001 From: shakilurrehman21 Date: Thu, 3 Dec 2026 11:32:45 +0530 Subject: [PATCH] Fix resize event listener target in useTocHighlight --- src/components/Layout/useTocHighlight.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Layout/useTocHighlight.tsx b/src/components/Layout/useTocHighlight.tsx index 02385409ff60..819e652d5896 100644 --- a/src/components/Layout/useTocHighlight.tsx +++ b/src/components/Layout/useTocHighlight.tsx @@ -69,7 +69,7 @@ export function useTocHighlight() { } document.addEventListener('scroll', throttledUpdateActiveLink); - document.addEventListener('resize', throttledUpdateActiveLink); + window.addEventListener('resize', throttledUpdateActiveLink); updateActiveLink(); @@ -79,7 +79,7 @@ export function useTocHighlight() { timeoutRef.current = null; } document.removeEventListener('scroll', throttledUpdateActiveLink); - document.removeEventListener('resize', throttledUpdateActiveLink); + window.removeEventListener('resize', throttledUpdateActiveLink); }; }, []);