Skip to content
TypeScript

fix(web): stop composer banner glass overlap (#8034)

t3-code[bot]0d2382950bd3
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 19455dfc48f..fd28d2dd095 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -1356,6 +1356,7 @@ export default function ChatView(props: ChatViewProps) {
const getTimelineScrollableNodeStable = useStableCallback(getTimelineScrollableNode);
const [composerOverlayElement, setComposerOverlayElement] = useState<HTMLDivElement | null>(null);
const [composerTimelineInset, setComposerTimelineInset] = useState(0);
+ const [composerOverlayHeight, setComposerOverlayHeight] = useState(0);
const composerTimelineInsetRef = useRef(0);
const composerRestingRef = useRef(false);
const composerMountedRef = useRef(true);
@@ -4678,6 +4679,7 @@ export default function ChatView(props: ChatViewProps) {
const publishComposerOverlayHeight = (height: number) => {
const nextHeight = Math.ceil(height);
if (nextHeight <= 0) return;
+ setComposerOverlayHeight(isDraftHeroState ? 0 : nextHeight);
const isResting = overlayComposerIsResting({
composerMounted: composerMountedRef.current,
composerReportedResting: composerRestingRef.current,
@@ -8072,6 +8074,7 @@ export default function ChatView(props: ChatViewProps) {
onAnchorReady={onTimelineAnchorReadyStable}
onAnchorSizeChanged={onTimelineAnchorSizeChangedStable}
contentInsetEndAdjustment={composerTimelineInset}
+ composerOverlayHeight={isDraftHeroState ? 0 : composerOverlayHeight}
liveFollowEnabled={!paintOnlyDisplayedTimeline && timelineLiveFollowEnabled}
onIsAtEndChange={onIsAtEndChangeStable}
onContentOverflowChange={setTimelineOverflows}
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index 02ba86e463d..2e742370c42 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -84,6 +84,7 @@ import {
type KeyboardEvent,
type MouseEvent,
type ReactNode,
+ type CSSProperties,
} from "react";
import {
LegendList,
@@ -506,6 +507,7 @@ interface MessagesTimelineProps {
onAnchorReady: (messageId: MessageId, anchorIndex: number) => void;
onAnchorSizeChanged: (messageId: MessageId, size: number) => void;
contentInsetEndAdjustment: number;
+ composerOverlayHeight?: number;
onIsAtEndChange: (isAtEnd: boolean) => void;
/**
* Off while the user is reading history; LegendList's own maintainScrollAtEnd
@@ -602,6 +604,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
onAnchorReady,
onAnchorSizeChanged,
contentInsetEndAdjustment,
+ composerOverlayHeight = 0,
onIsAtEndChange,
onContentOverflowChange,
liveFollowEnabled,
@@ -1090,6 +1093,12 @@ const ConversationTimeline = memo(function ConversationTimeline({
{footer}
</TimelineListFooter>
);
+ const timelineMaskStyle =
+ composerOverlayHeight === 0
+ ? undefined
+ : ({
+ "--timeline-composer-overlay-height": `${composerOverlayHeight}px`,
+ } as CSSProperties);
const measureContentOverflow = () =>
timelineContentOverflowsViewport(listRef.current?.getState?.(), {
@@ -1471,52 +1480,60 @@ const ConversationTimeline = memo(function ConversationTimeline({
onCite={onCiteAssistantText}
/>
) : null}
- <LegendList<MessagesTimelineRow>
- ref={setTimelineList}
- data={rows}
- extraData={listExtraData}
- keyExtractor={keyExtractor}
- getItemType={getItemType}
- renderItem={renderItem}
- estimatedItemSize={90}
- initialScrollAtEnd={
- !findActive && citationRequest === null && rememberedPosition?.atEnd !== false
- }
- // Legend needs a data refresh to mount new pins without a scroll event.
- dataVersion={readyCitationRequest?.key ?? listIdentityKey}
- {...(alwaysRender ? { alwaysRender } : {})}
- onLoad={handleListLoad}
- {...(anchoredEndSpace ? { anchoredEndSpace } : {})}
- contentInsetEndAdjustment={anchoredEndSpace ? contentInsetEndAdjustment : 0}
- maintainScrollAtEnd={
- citationPositioning ||
- (restoringThreadPosition && rememberedPosition?.atEnd === false) ||
- anchoredEndSpace ||
- !liveFollowEnabled ||
- fullscreenAppRowId !== null ||
- disclosureToggleSettling
- ? false
- : isWorking && !prefersReducedMotion && settlingListIdentity === null
- ? TIMELINE_MAINTAIN_SCROLL_AT_END_SMOOTH
- : TIMELINE_MAINTAIN_SCROLL_AT_END
- }
- maintainVisibleContentPosition={
- findActive ||
- citationPositioning ||
- (restoringThreadPosition && rememberedPosition?.atEnd === false)
- ? false
- : maintainVisibleContentPosition
- }
- maintainScrollAtEndThreshold={1}
- onScroll={handleScroll}
- onItemSizeChanged={handleItemSizeChanged}
+ <div
className={cn(
- "messages-timeline-scroll scrollbar-gutter-both h-full min-h-0 overflow-x-hidden overscroll-y-contain [overflow-anchor:none]",
- topFadeEnabled && "topbar-scroll-fade",
+ "h-full min-h-0",
+ composerOverlayHeight > 0 && "virtualized-scroll-fade timeline-scroll-bottom-fade",
)}
- ListHeaderComponent={listHeader}
- ListFooterComponent={timelineListFooter}
- />
+ style={timelineMaskStyle}
+ >
+ <LegendList<MessagesTimelineRow>
+ ref={setTimelineList}
+ data={rows}
+ extraData={listExtraData}
+ keyExtractor={keyExtractor}
+ getItemType={getItemType}
+ renderItem={renderItem}
+ estimatedItemSize={90}
+ initialScrollAtEnd={
+ !findActive && citationRequest === null && rememberedPosition?.atEnd !== false
+ }
+ // Legend needs a data refresh to mount new pins without a scroll event.
+ dataVersion={readyCitationRequest?.key ?? listIdentityKey}
+ {...(alwaysRender ? { alwaysRender } : {})}
+ onLoad={handleListLoad}
+ {...(anchoredEndSpace ? { anchoredEndSpace } : {})}
+ contentInsetEndAdjustment={anchoredEndSpace ? contentInsetEndAdjustment : 0}
+ maintainScrollAtEnd={
+ citationPositioning ||
+ (restoringThreadPosition && rememberedPosition?.atEnd === false) ||
+ anchoredEndSpace ||
+ !liveFollowEnabled ||
+ fullscreenAppRowId !== null ||
+ disclosureToggleSettling
+ ? false
+ : isWorking && !prefersReducedMotion && settlingListIdentity === null
+ ? TIMELINE_MAINTAIN_SCROLL_AT_END_SMOOTH
+ : TIMELINE_MAINTAIN_SCROLL_AT_END
+ }
+ maintainVisibleContentPosition={
+ findActive ||
+ citationPositioning ||
+ (restoringThreadPosition && rememberedPosition?.atEnd === false)
+ ? false
+ : maintainVisibleContentPosition
+ }
+ maintainScrollAtEndThreshold={1}
+ onScroll={handleScroll}
+ onItemSizeChanged={handleItemSizeChanged}
+ className={cn(
+ "messages-timeline-scroll scrollbar-gutter-both h-full min-h-0 overflow-x-hidden overscroll-y-contain [overflow-anchor:none]",
+ topFadeEnabled && "topbar-scroll-fade",
+ )}
+ ListHeaderComponent={listHeader}
+ ListFooterComponent={timelineListFooter}
+ />
+ </div>
<TimelineMinimap
items={minimapItems}
hasPersistentGutter={minimapHasPersistentGutter}
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 63555806aa8..4fba227fbc9 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -497,6 +497,16 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
var(--app-scrollbar-width) 100%;
}
+@utility timeline-scroll-bottom-fade {
+ --virtualized-scroll-fade-mask: linear-gradient(
+ to bottom,
+ black 0,
+ black calc(100% - var(--timeline-composer-overlay-height) - 0.75rem),
+ transparent calc(100% - var(--timeline-composer-overlay-height)),
+ transparent 100%
+ );
+}
+
/* Stage-channel art needs a mask and pseudo-element gradient, so keep the
behavior composable without tying it to the global components layer. */
@utility sidebar-stage-backdrop {