From 1a8659dc3db2256451261b88aaab1b04c36d3d08 Mon Sep 17 00:00:00 2001 From: John Sell Date: Fri, 1 May 2026 21:59:19 -0400 Subject: [PATCH] feat(ui): add scroll-to-bottom button and improve scroll navigation in session view Add a scroll-to-bottom button alongside the existing scroll-to-top button in the session message view. Both buttons now animate smoothly, have tooltips, and correctly hide when content doesn't overflow. Fixes ghost tooltip appearing when buttons are hidden. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/components/session/MessagesTab.tsx | 51 ++++++-- .../messages/scroll-navigation.spec.md | 115 ++++++++++++++++++ 2 files changed, 154 insertions(+), 12 deletions(-) create mode 100644 specs/frontend/sessions/messages/scroll-navigation.spec.md diff --git a/components/frontend/src/components/session/MessagesTab.tsx b/components/frontend/src/components/session/MessagesTab.tsx index 26f7d0ba1..21a8925b4 100755 --- a/components/frontend/src/components/session/MessagesTab.tsx +++ b/components/frontend/src/components/session/MessagesTab.tsx @@ -1,10 +1,11 @@ "use client"; import React, { useState, useRef, useEffect, useMemo, useLayoutEffect, useCallback } from "react"; -import { MessageSquare, ChevronUp } from "lucide-react"; +import { MessageSquare, ChevronUp, ChevronDown } from "lucide-react"; import { StreamMessage } from "@/components/ui/stream-message"; import { LoadingDots } from "@/components/ui/message"; import { Button } from "@/components/ui/button"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { ChatInputBox } from "@/components/chat/ChatInputBox"; import { QueuedMessageBubble } from "@/components/chat/QueuedMessageBubble"; import { useCurrentUser } from "@/services/queries/use-auth"; @@ -99,6 +100,7 @@ const MessagesTab: React.FC = ({ session, streamMessages, chat const checkIfAtBottom = () => { const container = messagesContainerRef.current; if (!container) return true; + if (container.scrollHeight <= container.clientHeight) return true; const threshold = 50; return container.scrollHeight - container.scrollTop - container.clientHeight < threshold; }; @@ -287,17 +289,42 @@ const MessagesTab: React.FC = ({ session, streamMessages, chat )} - {showScrollToTop && ( - - )} + +
+
+ + + + + Scroll to top + +
+
+ + + + + Scroll to bottom + +
+
+