From c8991433042a762d536497a7c60a49c8d46013e4 Mon Sep 17 00:00:00 2001 From: lbgos <285507185+lbgos@users.noreply.github.com> Date: Thu, 26 Nov 2026 10:48:17 +0200 Subject: [PATCH] fix(web): float and fade the jump-to-latest button without shrinking the composer On narrow screens, the jump-to-latest button sat inline beside the composer and shrunk the message field when scrolled up, and it popped in and out instantly everywhere. Keep ScrollToEndButton mounted with a visibility attribute so its opacity transitions over 160ms ease-out (hiding with visibility: hidden and pointer-events: none when settled, and no transition under reduced motion). On narrow bot chats, remove the composer width-shrinking rules and float the button just above the composer at the right edge; wide screens keep the gutter placement outside the field. --- apps/web/src/bots/bots.css | 54 ++++++++----------- apps/web/src/components/ChatView.tsx | 16 +++--- .../src/components/chat/TimelineOverlays.tsx | 10 +++- apps/web/src/components/guest/GuestPage.tsx | 13 +++-- apps/web/src/index.css | 26 +++++++++ 5 files changed, 72 insertions(+), 47 deletions(-) diff --git a/apps/web/src/bots/bots.css b/apps/web/src/bots/bots.css index 8349e64b7..f9641358e 100644 --- a/apps/web/src/bots/bots.css +++ b/apps/web/src/bots/bots.css @@ -188,8 +188,9 @@ html:active-view-transition[data-bots-app] [data-chat-composer-overlay]::before { background-color: var(--bots-page) !important; } -/* The jump-to-latest disc stands in the composer's area, so it never covers the transcript. On a - wide lane it sits in the gutter after the composer, level with its top edge. */ +/* The jump-to-latest disc stays out of the composer field. On a wide lane it sits in the gutter + after the composer, level with its top edge; on a narrow lane it floats just above the composer + at its right edge. */ @media (min-width: 640px) { :root[data-bots-app] [data-bots-mode="true"] .chat-scroll-to-bottom { bottom: calc(var(--bot-composer-height, 0px) - 2.5rem) !important; @@ -200,36 +201,12 @@ html:active-view-transition[data-bots-app] margin-inline-start: calc((100% + min(100%, var(--chat-content-max-width))) / 2 + 0.5rem); } } -/* A narrow lane has no gutter: the disc ends the composer's row, as the attach disc starts it, - and the capsule between them gives up that much of its width. */ @media (max-width: 639px) { :root[data-bots-app] [data-bots-mode="true"] .chat-scroll-to-bottom { - bottom: max(env(safe-area-inset-bottom), 0.5rem) !important; + bottom: calc(var(--bot-composer-height, 0px) + 0.375rem) !important; justify-content: flex-end; - padding: 0 calc(env(safe-area-inset-right) + 0.75rem) 0 0; - } - :root[data-bots-app][data-keyboard-open] [data-bots-mode="true"] .chat-scroll-to-bottom { - bottom: 0.5rem !important; - } - :root[data-bots-app] [data-bots-mode="true"] .chat-scroll-to-bottom [data-slot="button"] { - width: 2.75rem; - height: 2.75rem; - } - :root[data-bots-app] - [data-bots-mode="true"] - :has(> .chat-scroll-to-bottom) - ~ [data-chat-composer-overlay] - [data-bot-composer="true"] - [data-chat-composer-surface] { - padding-inline-end: 3.25rem; - } - :root[data-bots-app] - [data-bots-mode="true"] - :has(> .chat-scroll-to-bottom) - ~ [data-chat-composer-overlay] - [data-bot-composer="true"] - [data-chat-composer-surface]::after { - inset-inline-end: 3.25rem; + padding: 0 calc(env(safe-area-inset-right) + 0.75rem) 0 + calc(env(safe-area-inset-left) + 0.75rem); } } /* A tab screen's list ends above the tab bar. */ @@ -344,6 +321,19 @@ html[data-bots-app] body { :is([data-slot="button"], [data-bots-tab-bar] button, [data-bots-tab-search]) { transition: scale 120ms cubic-bezier(0.2, 0.8, 0.2, 1) !important; } + /* The jump-to-latest disc fades in and out in place, then hides so it paints nothing at rest. */ + :root[data-bots-app] .chat-scroll-to-bottom [data-scroll-to-end] { + transition: + scale 120ms cubic-bezier(0.2, 0.8, 0.2, 1), + opacity 160ms ease-out, + visibility 0s linear 160ms !important; + } + :root[data-bots-app] .chat-scroll-to-bottom[data-visible="true"] [data-scroll-to-end] { + transition: + scale 120ms cubic-bezier(0.2, 0.8, 0.2, 1), + opacity 160ms ease-out, + visibility 0s linear 0s !important; + } /* A message, the typing bubble or a bot row that just arrived rises in once (data-row-enter). */ :root[data-bots-app] [data-row-enter] { animation: bots-row-enter 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both !important; @@ -2018,7 +2008,8 @@ html[data-bots-app]:has( [data-bot-header-actions] :is([data-slot="button"], [data-slot="menu-trigger"]), [data-settings-page-header] [data-slot="button"]:not([data-settings-bar-action] *), [data-bots-mode="true"] [data-composer-banner-surface], - [data-bot-composer="true"] [data-chat-composer-attach] button + [data-bot-composer="true"] [data-chat-composer-attach] button, + [data-bots-mode="true"] .chat-scroll-to-bottom [data-slot="button"] ), /* The capsule is a pseudo-element, which :is() cannot hold. */ :root[data-bots-app] [data-bot-composer="true"] [data-chat-composer-surface]::after { @@ -2051,7 +2042,8 @@ html[data-bots-app]:has( [data-bot-header-actions] :is([data-slot="button"], [data-slot="menu-trigger"]), [data-settings-page-header] [data-slot="button"]:not([data-settings-bar-action] *), [data-bots-mode="true"] [data-composer-banner-surface], - [data-bot-composer="true"] [data-chat-composer-attach] button + [data-bot-composer="true"] [data-chat-composer-attach] button, + [data-bots-mode="true"] .chat-scroll-to-bottom [data-slot="button"] ), html:active-view-transition[data-bots-app] [data-bot-composer="true"] diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index d5d0623fa..c39dc66ab 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -3599,14 +3599,14 @@ export default function ChatView(props: ChatViewProps) { /> - {showScrollToBottom && !isThreadFindActive && ( - scrollToEnd(true)} - /> - )} + scrollToEnd(true)} + />
void; }) { + const visible = props.visible ?? true; if (props.compact) { return (
follow.scrollToEnd(true)} /> diff --git a/apps/web/src/index.css b/apps/web/src/index.css index 3e981f9bd..e97414ddd 100644 --- a/apps/web/src/index.css +++ b/apps/web/src/index.css @@ -2671,6 +2671,32 @@ code { } } +.chat-scroll-to-bottom[data-visible="false"] [data-scroll-to-end] { + pointer-events: none; + opacity: 0; + visibility: hidden; +} +.chat-scroll-to-bottom[data-visible="true"] [data-scroll-to-end] { + opacity: 1; + visibility: visible; +} +@media (prefers-reduced-motion: no-preference) { + .chat-scroll-to-bottom [data-scroll-to-end] { + transition: + box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1), + scale 150ms cubic-bezier(0.4, 0, 0.2, 1), + opacity 160ms ease-out, + visibility 0s linear 160ms; + } + .chat-scroll-to-bottom[data-visible="true"] [data-scroll-to-end] { + transition: + box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1), + scale 150ms cubic-bezier(0.4, 0, 0.2, 1), + opacity 160ms ease-out, + visibility 0s linear 0s; + } +} + /* A workspace area with no control of its own takes F6 focus itself; keep that visible. workspaceFocus.ts marks those, since :focus-visible also matches a clicked area after a key press. The conversation's timeline takes it instead, and its top fade mask would hide its own ring. */