From ccb15dae0986308d4b0ee1d99fe5ef7b99b17975 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 14 Feb 2026 01:04:39 +0000 Subject: [PATCH] Reduce copilot scroll stickiness for consistent, less-sticky behavior - Changed default stickinessThreshold from 100 to 30 in use-scroll-management.ts - Removed explicit stickinessThreshold override (40) from copilot.tsx - Both copilot and chat now use the same default value of 30 - This makes scrolling less sticky across all copilot message interactions Co-authored-by: Emir Karabeg --- .../components/panel/components/copilot/copilot.tsx | 6 ++---- .../w/[workflowId]/hooks/use-scroll-management.ts | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx index 18222f8df..479dde41d 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx @@ -131,10 +131,8 @@ export const Copilot = forwardRef(({ panelWidth }, ref resumeActiveStream, }) - // Handle scroll management (80px stickiness for copilot) - const { scrollAreaRef, scrollToBottom } = useScrollManagement(messages, isSendingMessage, { - stickinessThreshold: 40, - }) + // Handle scroll management + const { scrollAreaRef, scrollToBottom } = useScrollManagement(messages, isSendingMessage) // Handle chat history grouping const { groupedChats, handleHistoryDropdownOpen: handleHistoryDropdownOpenHook } = useChatHistory( diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-scroll-management.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-scroll-management.ts index 8b43eee10..9a330475d 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-scroll-management.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-scroll-management.ts @@ -16,7 +16,7 @@ interface UseScrollManagementOptions { /** * Distance from bottom (in pixels) within which auto-scroll stays active * @remarks Lower values = less sticky (user can scroll away easier) - * @defaultValue 100 + * @defaultValue 30 */ stickinessThreshold?: number } @@ -41,7 +41,7 @@ export function useScrollManagement( const lastScrollTopRef = useRef(0) const scrollBehavior = options?.behavior ?? 'smooth' - const stickinessThreshold = options?.stickinessThreshold ?? 100 + const stickinessThreshold = options?.stickinessThreshold ?? 30 /** Scrolls the container to the bottom */ const scrollToBottom = useCallback(() => {