Skip to content

Commit 7a0d572

Browse files
fix(web): let scroll collapse an unfocused composer when blur collapse is off
The wheel handler required the prompt editor to be focused, which was a proxy for "the composer is expanded" back when unfocused always meant resting. With blur collapse off an unfocused composer stays expanded and scrolling could not rest it. Key the eligibility off the resting state instead. Co-Authored-By: Claude Code <[email protected]>
1 parent 81a18d6 commit 7a0d572

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,10 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
36213621
settings.composerCollapseOnScroll &&
36223622
!composerHasExpandedChrome &&
36233623
!showInlineTasksBadge;
3624-
composerScrollCollapseEligibleRef.current = canScrollCollapseComposer;
3624+
// Scrolling only has something to collapse while the composer is expanded.
3625+
// With blur collapse off that includes an unfocused composer, so the wheel
3626+
// handler keys off this rather than editor focus.
3627+
composerScrollCollapseEligibleRef.current = canScrollCollapseComposer && !isComposerResting;
36253628

36263629
useEffect(() => {
36273630
if (!canScrollCollapseComposer) {
@@ -3662,11 +3665,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
36623665
resetComposerScrollGesture(composerScrollGestureRef.current);
36633666
};
36643667
const handleTimelineWheel = (event: WheelEvent) => {
3665-
const activeElement = document.activeElement;
3666-
const isPromptEditorFocused =
3667-
activeElement instanceof HTMLElement &&
3668-
activeElement.isContentEditable &&
3669-
composerFormRef.current?.contains(activeElement) === true;
36703668
if (event.ctrlKey || !(event.target instanceof Element)) {
36713669
return;
36723670
}
@@ -3700,8 +3698,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
37003698
now: window.performance.now(),
37013699
deltaPx,
37023700
collapseThresholdPx: COMPOSER_SCROLL_COLLAPSE_THRESHOLD_PX,
3703-
collapseEligible:
3704-
targetsTimeline && composerScrollCollapseEligibleRef.current && isPromptEditorFocused,
3701+
collapseEligible: targetsTimeline && composerScrollCollapseEligibleRef.current,
37053702
canScrollInGestureDirection,
37063703
scrollsTowardLogicalEnd: event.deltaY > 0 && isTimelineAtLogicalEnd(),
37073704
});

0 commit comments

Comments
 (0)