feat: Add peek animation and hide scrollbars in DM lists

- Add `.no-scrollbar` utility to hide scrollbars while keeping scrollability.
- Apply `.no-scrollbar` to ConversationList and MessageThread containers.
- Implement "peek" animation:
    - ConversationList: scrolls down 40px then back up on load.
    - MessageThread: scrolls up 40px then back down (to bottom) on load.
- Animation only triggers if content overflows.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-23 05:02:31 +00:00
1 parent 28a01bd13f
commit d989e09bdf
4 files changed
+650 -6

No files matched your search

+19 -5
View File
@@ -93,7 +93,7 @@ export function MessageThread({
}
root.appendChild(header);
const timeline = createElement(doc, "div", "dm-message-thread__timeline");
const timeline = createElement(doc, "div", "dm-message-thread__timeline no-scrollbar");
timeline.setAttribute("role", "log");
timeline.setAttribute("aria-live", "polite");
@@ -137,11 +137,25 @@ export function MessageThread({
});
}
// Scroll to bottom
// Scroll to bottom and peek
if (messages.length > 0) {
setTimeout(() => {
timeline.scrollTop = timeline.scrollHeight;
}, 0);
setTimeout(() => {
timeline.scrollTop = timeline.scrollHeight;
if (timeline.scrollHeight > timeline.clientHeight) {
setTimeout(() => {
const targetScroll = Math.max(0, timeline.scrollTop - 40);
timeline.scrollTo({ top: targetScroll, behavior: "smooth" });
setTimeout(() => {
timeline.scrollTo({
top: timeline.scrollHeight,
behavior: "smooth",
});
}, 600);
}, 600);
}
}, 0);
}
root.appendChild(timeline);