Skip to content

Commit

Permalink
webui: fix autoscroll behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
picoHz committed Jul 4, 2023
1 parent da7e670 commit c3e3810
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions taxy-webui/src/pages/log_view.rs
Expand Up @@ -82,10 +82,12 @@ fn poll_log(
setter.set(history.clone());

if let Some(elem) = ul_ref.cast::<Element>() {
Timeout::new(0, move || {
elem.set_scroll_top(elem.scroll_height());
})
.forget();
if elem.scroll_top() == elem.scroll_height() {
Timeout::new(0, move || {
elem.set_scroll_top(elem.scroll_height());
})
.forget();
}
poll_log(id, ul_ref, setter, history, time);
}
}
Expand Down

0 comments on commit c3e3810

Please sign in to comment.