Skip to content

Build your personal knowledge base with Trilium Notes

feat(llm): fade sidebar chat messages under the section title bar

Elian Doran6463637388d9
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 5402360423..45dddeb188 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1711,6 +1711,28 @@ body:not(.mobile) #launcher-pane.horizontal .dropdown-submenu > .dropdown-menu {
background-color: var(--selection-background-color);
}
+/*
+ * Fades a scroll container's content out at its edges instead of hard-clipping it, so text
+ * dissolves toward whatever chrome sits past the edge (a section title bar, a composer).
+ * A mask rather than an overlay gradient because the content becomes genuinely transparent:
+ * this holds up when the pane background is a semi-transparent tint over a window material
+ * (Mica/vibrancy), which no painted gradient color could match. Opt in per edge by setting
+ * `--scroll-fade-top` / `--scroll-fade-bottom` on the scroll container (or an ancestor);
+ * each edge defaults to a hard clip. The defaults are `var()` fallbacks rather than custom
+ * property declarations here, so a widget's knobs win regardless of stylesheet bundling
+ * order. The overlay scrollbar fades over the same distance — the cost of masking the
+ * scroll container itself, accepted wherever this is used.
+ */
+.scroll-edge-fade {
+ mask-image: linear-gradient(
+ to bottom,
+ transparent,
+ black var(--scroll-fade-top, 0px),
+ black calc(100% - var(--scroll-fade-bottom, 0px)),
+ transparent
+ );
+}
+
[data-bs-toggle="tooltip"]:not(.button-widget) span {
padding-bottom: 0;
border-bottom: 1px dotted;
diff --git a/apps/client/src/widgets/sidebar/SidebarChat.css b/apps/client/src/widgets/sidebar/SidebarChat.css
index e38c765aba..dae3c6c98a 100644
--- a/apps/client/src/widgets/sidebar/SidebarChat.css
+++ b/apps/client/src/widgets/sidebar/SidebarChat.css
@@ -18,7 +18,13 @@
/* Scroll-container essentials (flex/min-height/overflow) come from .chat-message-list. */
.sidebar-chat-messages {
+ /* Messages scrolling up dissolve under the section's title bar instead of clipping
+ against it. Sidebar-only for now: the note-type chat has no chrome at its top edge. */
+ --scroll-fade-top: 20px;
padding: 0.5rem;
+ /* Room past the fade, so the first message at rest sits fully legible and only
+ content actually scrolling away enters the dissolve. */
+ padding-top: calc(var(--scroll-fade-top) + 0.25rem);
display: flex;
flex-direction: column;
gap: 0.5rem;
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.css b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.css
index f047f05db5..9bb1ab4f36 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.css
@@ -19,13 +19,9 @@
/* Layout/paint changes inside the timeline (e.g. streaming appends) stay inside it;
the element's own size comes from the flex container, so this is safe and free. */
contain: layout paint;
- /* Soften the clip edge above the composer island: the text fades to genuine
- transparency rather than being painted over, so this holds up when the pane
- background is a semi-transparent tint over Mica (desktop background effects),
- where no overlay gradient color could match. Same idiom as ListOrGridView and
- MobileNoteNavigator. The overlay scrollbar's last few px fade with it — accepted
- there too. Kept short so the newest streaming line doesn't sit in the fade. */
- mask-image: linear-gradient(to bottom, black calc(100% - 20px), transparent 100%);
+ /* Soften the clip edge above the composer island (see `.scroll-edge-fade` in style.css
+ for why a mask). Kept short so the newest streaming line doesn't sit in the fade. */
+ --scroll-fade-bottom: 20px;
}
/* Content-end sentinel watched by the jump-to-latest IntersectionObserver. A 1px
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.tsx
index 640e6e7953..58c231fa38 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessageList.tsx
@@ -61,7 +61,7 @@ export default function ChatMessageList({ chat, emptyStateText, className }: Cha
return (
<div className="chat-message-list-wrapper">
- <div className={`chat-message-list ${className ?? ""}`} ref={chat.scrollContainerRef}>
+ <div className={`chat-message-list scroll-edge-fade ${className ?? ""}`} ref={chat.scrollContainerRef}>
{messages.length === 0 && !isStreaming && (
<NoItems icon="bx bx-conversation" text={emptyStateText} />
)}