style: Improve readability of isElementScrollable function
This commit is contained in:
parent
ab6c8bad3f
commit
183656213e
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user