rework/lightweight #12

Merged
GauthierWebDev merged 106 commits from rework/lightweight into main 2025-04-21 16:27:38 +00:00
Showing only changes of commit 183656213e - Show all commits

View File

@ -50,7 +50,10 @@ export function SmoothScroll(props: SmoothScrollProps) {
const isElementScrollable = (element: HTMLElement) => { const isElementScrollable = (element: HTMLElement) => {
if (!element) return false; if (!element) return false;
return element.scrollHeight > element.clientHeight;
return (
element.scrollHeight > element.clientHeight && element.tagName !== "HTML"
);
}; };
const findScrollableParent = (element: HTMLElement) => { const findScrollableParent = (element: HTMLElement) => {
@ -74,6 +77,7 @@ export function SmoothScroll(props: SmoothScrollProps) {
event.clientX, event.clientX,
event.clientY, event.clientY,
) as HTMLElement; ) as HTMLElement;
if (findScrollableParent(hoveredElement)) { if (findScrollableParent(hoveredElement)) {
if (animationFrameId !== null) cancelAnimationFrame(animationFrameId); if (animationFrameId !== null) cancelAnimationFrame(animationFrameId);
return; return;