diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx
index 526cbbc0..0619dc5a 100644
--- a/src/components/timeline.jsx
+++ b/src/components/timeline.jsx
@@ -149,7 +149,7 @@ function Timeline({
     const activeItemRect = activeItem?.getBoundingClientRect();
     const allItems = Array.from(
       scrollableRef.current.querySelectorAll(itemsSelector),
-    );
+    ).filter((item) => !!item.offsetHeight);
     if (
       activeItem &&
       activeItemRect.top < scrollableRef.current.clientHeight &&
@@ -188,7 +188,7 @@ function Timeline({
     const activeItemRect = activeItem?.getBoundingClientRect();
     const allItems = Array.from(
       scrollableRef.current.querySelectorAll(itemsSelector),
-    );
+    ).filter((item) => !!item.offsetHeight);
     if (
       activeItem &&
       activeItemRect.top < scrollableRef.current.clientHeight &&