Skip to content

Commit b22627e

Browse files
authored
Merge pull request #560 from ivan/log-window-scroll-down
2 parents efacb6d + bb39bf8 commit b22627e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

dashboard/assets/scripts/dashboard.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,22 @@ class Dashboard {
986986
byId("read-the-help").style.display = "block";
987987
}
988988

989+
// We automatically scroll log windows to the bottom as lines are added,
990+
// and for performance reasons we have `content-visibility: auto` to skip
991+
// rendering when they are outside the viewport (at least in Chrome where
992+
// this CSS property is supported).
993+
//
994+
// However, when they are outside the viewport, they fail to get scrolled
995+
// to the bottom by `scrollToBottom` because they aren't rendering anything.
996+
// Listen to contentvisibilityautostatechange and scroll these log windows
997+
// to the bottom after they go back into the viewport and their rendering
998+
// is no longer being skipped.
999+
document.body.addEventListener("contentvisibilityautostatechange", (ev) => {
1000+
if (!ev.skipped && ev.target.classList.contains("log-window")) {
1001+
scrollToBottom(ev.target);
1002+
}
1003+
});
1004+
9891005
this.messageCount = 0;
9901006
this.newItemsReceived = 0;
9911007
this.newBytesReceived = 0;

0 commit comments

Comments
 (0)