Skip to content

Commit

Permalink
Fix scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Jan 4, 2025
1 parent ecc23aa commit 8d21c6a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions core/src/main/resources/lib/hudson/progressive-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Behaviour.specify(
let errorMessage = holder.getAttribute("data-error-message");

var scroller = new AutoScroller(document.body);
// TODO - Hacky
var scroller = new AutoScroller(holder.closest(".terminalinside") || document.body);
/*
fetches the latest update from the server
@param e
Expand Down
4 changes: 2 additions & 2 deletions src/main/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
}

.terminalinside {
min-height: 370px;
max-height: 370px;
min-height: 340px;
max-height: 340px;
overflow-y: auto;
margin: 0 -1rem -1rem;
padding: 0 1rem 1rem;
Expand Down
10 changes: 7 additions & 3 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -2030,10 +2030,14 @@ function AutoScroller(scrollContainer) {
scrollToBottom: function () {
var scrollDiv = this.scrollContainer;
var currentHeight = this.getCurrentHeight();
if (document.documentElement) {
document.documentElement.scrollTop = currentHeight;

if (scrollDiv === document.body) {
window.scrollTo({
top: currentHeight,
});
} else {
scrollDiv.scrollTop = currentHeight;
}
scrollDiv.scrollTop = currentHeight;
},
};
}
Expand Down

0 comments on commit 8d21c6a

Please sign in to comment.