Skip to content

Commit ccb15da

Browse files
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 <emir-karabeg@users.noreply.github.com>
1 parent 3ef6b05 commit ccb15da

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ export const Copilot = forwardRef<CopilotRef, CopilotProps>(({ panelWidth }, ref
131131
resumeActiveStream,
132132
})
133133

134-
// Handle scroll management (80px stickiness for copilot)
135-
const { scrollAreaRef, scrollToBottom } = useScrollManagement(messages, isSendingMessage, {
136-
stickinessThreshold: 40,
137-
})
134+
// Handle scroll management
135+
const { scrollAreaRef, scrollToBottom } = useScrollManagement(messages, isSendingMessage)
138136

139137
// Handle chat history grouping
140138
const { groupedChats, handleHistoryDropdownOpen: handleHistoryDropdownOpenHook } = useChatHistory(

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-scroll-management.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface UseScrollManagementOptions {
1616
/**
1717
* Distance from bottom (in pixels) within which auto-scroll stays active
1818
* @remarks Lower values = less sticky (user can scroll away easier)
19-
* @defaultValue 100
19+
* @defaultValue 30
2020
*/
2121
stickinessThreshold?: number
2222
}
@@ -41,7 +41,7 @@ export function useScrollManagement(
4141
const lastScrollTopRef = useRef(0)
4242

4343
const scrollBehavior = options?.behavior ?? 'smooth'
44-
const stickinessThreshold = options?.stickinessThreshold ?? 100
44+
const stickinessThreshold = options?.stickinessThreshold ?? 30
4545

4646
/** Scrolls the container to the bottom */
4747
const scrollToBottom = useCallback(() => {

0 commit comments

Comments
 (0)