Skip to content

Commit

Permalink
luci-mod-status: fix syslog / dmesg scroll for some themes
Browse files Browse the repository at this point in the history
The actual code moves the scroll in the window. This works for the bootstrap theme, because the scroll is at window level. But this does not work for other themes, like material.

This commit changes the move of the scroll by "focusing" the window in the opposite button element in the syslog / dmesg page. In this way the move is automatically done by the browser.

Another solution is to "search" in the parent until we find the scroll and move it, but seems less solid.

Signed-off-by: Miguel Angel Mulero Martinez <[email protected]>
  • Loading branch information
McGiverGim authored and systemcrash committed Mar 27, 2024
1 parent b69bce0 commit 1164d27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ return view.extend({
}, _('Scroll to tail', 'scroll to bottom (the tail) of the log file')
);
scrollDownButton.addEventListener('click', function() {
window.scrollTo(0, document.body.scrollHeight);
scrollUpButton.focus();
});

var scrollUpButton = E('button', {
Expand All @@ -31,7 +31,7 @@ return view.extend({
}, _('Scroll to head', 'scroll to top (the head) of the log file')
);
scrollUpButton.addEventListener('click', function() {
window.scrollTo(0, 0);
scrollDownButton.focus();
});

return E([], [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ return view.extend({
}, _('Scroll to tail', 'scroll to bottom (the tail) of the log file')
);
scrollDownButton.addEventListener('click', function() {
window.scrollTo(0, document.body.scrollHeight);
scrollUpButton.focus();
});

var scrollUpButton = E('button', {
Expand All @@ -37,7 +37,7 @@ return view.extend({
}, _('Scroll to head', 'scroll to top (the head) of the log file')
);
scrollUpButton.addEventListener('click', function() {
window.scrollTo(0, 0);
scrollDownButton.focus();
});

return E([], [
Expand Down

0 comments on commit 1164d27

Please sign in to comment.