feat(ui): jump-to-latest pill with new-message count in the message list (LC-242) #298
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-242-jump-to-latest-pill"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements LC-242 (subtask LC-243). Adds a floating "jump to latest" pill over the room/DM message list: hidden while the viewer is pinned to the bottom, shown when they scroll up to read history. Messages arriving live while scrolled up increment a count on the pill; clicking it scrolls to the bottom and clears the count. Fills the gap where live WebSocket arrivals appended off-screen with no indicator and no quick way back.
Implementation
Front-end only. No schema, route, or server change.
partials/jump_to_latest.html: the pill button. Included byroom/page.htmlanddm/page.htmlinside a newrelativewrapper around#messages, soabsoluteanchors it to the bottom-right of the message viewport, above the composer.partials/auto_scroll.htmlIIFE, reusing its#messagesref,isAtBottom()/wasAtBottomscroll tracking (same 50px slack), and theevt.target === messagesteardown:wasAtBottom(hidden at bottom, shown when scrolled up).htmx:oobAfterSwaponly when the swap targeted#messages(a new-messagebeforeendappend, not an edit/reaction/poll which target id-scoped nodes) AND the viewer is scrolled up.wasAtBottomis true when the canonical render lands.prefers-reduced-motion), resets the count, hides.i18n
The count is client-dynamic, so it cannot be server-rendered through
|tn. Localized one/many forms ride as data attributes (the establisheddata-lc-echo-*pattern); the%n%token is substituted with the live count in JS.en+esadded.aria-liveon the count,aria-labelon the button.Scope
Main
#messageslist in rooms and DMs. The thread panel is a separate, smaller scroller and is out of scope for v1 (noted on the ticket).Tests
routes_drafts) and the DM page (routes_dm_mute).just testandjust test-saasgreen; clippy + fmt clean.No operator-visible surface (no env var / config / API change), so no
[operator-action]marker.🤖 Generated with Claude Code
Add a floating "jump to latest" pill over the room/DM message list. It is hidden while the viewer is pinned to the bottom and appears when they scroll up to read history; messages arriving live while scrolled up increment a count on the pill ("3 new messages"), and clicking it scrolls to the bottom and clears the count. Fills the gap where live WS arrivals appended off-screen with no indicator and no quick way back. Front-end only, no schema/route/server change. Markup is a shared partial (partials/jump_to_latest.html) included by room/page.html and dm/page.html inside a new relative wrapper around #messages so the pill anchors to the bottom-right of the message viewport above the composer. All behaviour lives in the existing auto_scroll.html IIFE, reusing its #messages reference, isAtBottom()/wasAtBottom scroll tracking, and the evt.target===messages teardown: visibility toggles off wasAtBottom; the count increments on htmx:oobAfterSwap only when the swap targeted #messages (a new-message beforeend append, not an edit/reaction/poll which target id-scoped nodes) and the viewer is scrolled up; own sends do not increment because the LC-230 optimistic echo jumps to bottom first; click scrolls (smooth, or instant under prefers-reduced-motion), resets, and hides. i18n: the count is client-dynamic so it cannot be server-rendered via |tn; localized one/many forms ride as data attributes (the data-lc-echo-* pattern) and the %n% token is substituted in JS. en + es added; aria-live on the count, aria-label on the button. Scope is the main #messages list in rooms and DMs; the thread panel is out of scope for v1. Tests: pill renders hidden with resolved i18n on the room page (routes_drafts) and the DM page (routes_dm_mute). just test and just test-saas green; clippy + fmt clean. #LC-242 #LC-243 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>