summaryrefslogtreecommitdiff
path: root/Omni/Jr
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-01 14:18:05 -0500
committerBen Sima <ben@bensima.com>2025-12-01 14:18:05 -0500
commitbe072e74b5fd6e9fe95dd93e685cb0a0fe8c5fbe (patch)
tree3ebb9f5754de6d5d06bf80164c2110ffabc72c2c /Omni/Jr
parent45841c3f948dabcc177d2306246020bc339709ae (diff)
Revert "Agent log box auto-scrolls to bottom on updates"
This reverts commit 9c3034853c3cacea8a77358467acf46e75c982f5.
Diffstat (limited to 'Omni/Jr')
-rw-r--r--Omni/Jr/Web.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs
index 94b5766..ba65a88 100644
--- a/Omni/Jr/Web.hs
+++ b/Omni/Jr/Web.hs
@@ -2378,7 +2378,8 @@ 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::after-swap" "var log = this.querySelector('.timeline-events'); if(log) log.scrollTop = log.scrollHeight"
+ 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"
]
else []
Lucid.div_ ([Lucid.class_ "unified-timeline-section", Lucid.id_ "unified-timeline"] <> pollAttrs) <| do
@@ -2644,7 +2645,10 @@ timelineScrollScript =
[ "(function() {",
" var log = document.querySelector('.timeline-events');",
" if (log) {",
- " log.scrollTop = log.scrollHeight;",
+ " var isNearBottom = log.scrollHeight - log.scrollTop - log.clientHeight < 100;",
+ " if (isNearBottom) {",
+ " log.scrollTop = log.scrollHeight;",
+ " }",
" }",
"})();"
]