diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-01 14:03:55 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-01 14:03:55 -0500 |
| commit | 9c3034853c3cacea8a77358467acf46e75c982f5 (patch) | |
| tree | 0356d97003d3614a726035f635b46f847dcd40a6 /Omni/Jr | |
| parent | 7e03d8f323d44b972aeceb009928c977ee64fed2 (diff) | |
Agent log box auto-scrolls to bottom on updates
Simplify auto-scroll behavior to always scroll to bottom after HTMX swap,
rather than checking if user is near bottom. This ensures latest messages
are always visible as they come in.
Task-Id: t-208
Diffstat (limited to 'Omni/Jr')
| -rw-r--r-- | Omni/Jr/Web.hs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs index 8508560..aa97d96 100644 --- a/Omni/Jr/Web.hs +++ b/Omni/Jr/Web.hs @@ -2378,8 +2378,7 @@ renderUnifiedTimeline tid legacyComments events status now = do [ Lucid.makeAttribute "hx-get" ("/partials/task/" <> tid <> "/events"), Lucid.makeAttribute "hx-trigger" "every 3s", Lucid.makeAttribute "hx-swap" "innerHTML", - Lucid.makeAttribute "hx-on::before-request" "var log = this.querySelector('.timeline-events'); if(log) this.dataset.scroll = log.scrollTop", - Lucid.makeAttribute "hx-on::after-swap" "var log = this.querySelector('.timeline-events'); if(log && this.dataset.scroll) log.scrollTop = this.dataset.scroll" + Lucid.makeAttribute "hx-on::after-swap" "var log = this.querySelector('.timeline-events'); if(log) log.scrollTop = log.scrollHeight" ] else [] Lucid.div_ ([Lucid.class_ "unified-timeline-section", Lucid.id_ "unified-timeline"] <> pollAttrs) <| do @@ -2626,10 +2625,7 @@ timelineScrollScript = [ "(function() {", " var log = document.querySelector('.timeline-events');", " if (log) {", - " var isNearBottom = log.scrollHeight - log.scrollTop - log.clientHeight < 100;", - " if (isNearBottom) {", - " log.scrollTop = log.scrollHeight;", - " }", + " log.scrollTop = log.scrollHeight;", " }", "})();" ] |
