From 183656213ee0325fe9ed33d7743e2c160bb3622a Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Mon, 21 Apr 2025 18:25:11 +0200 Subject: [PATCH] style: Improve readability of isElementScrollable function --- app/components/SmoothScroll.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/components/SmoothScroll.tsx b/app/components/SmoothScroll.tsx index 6dccafd..f7dbdd1 100644 --- a/app/components/SmoothScroll.tsx +++ b/app/components/SmoothScroll.tsx @@ -50,7 +50,10 @@ export function SmoothScroll(props: SmoothScrollProps) { const isElementScrollable = (element: HTMLElement) => { if (!element) return false; - return element.scrollHeight > element.clientHeight; + + return ( + element.scrollHeight > element.clientHeight && element.tagName !== "HTML" + ); }; const findScrollableParent = (element: HTMLElement) => { @@ -74,6 +77,7 @@ export function SmoothScroll(props: SmoothScrollProps) { event.clientX, event.clientY, ) as HTMLElement; + if (findScrollableParent(hoveredElement)) { if (animationFrameId !== null) cancelAnimationFrame(animationFrameId); return;