Console does not remain always remain scrolled to bottom
Categories
(DevTools :: Console, defect, P2)
Tracking
(firefox101 fixed)
Tracking | Status | |
---|---|---|
firefox101 | --- | fixed |
People
(Reporter: jdescottes, Assigned: alexical)
Details
Attachments
(1 file)
I was looking at https://discourse.mozilla.org/t/how-to-make-the-console-automatically-scroll/36677/15 and I found a way to make the console lose its scroll to bottom
STRs
- open console (scrolled to bottom)
- run:
for (var i = 1; i < 100; i++) {
window["a" + i] = (function(j) { window["a" + j]() }).bind(null, i+1)
}
function a100() {
console.warn(new Error("test"));
}
window.setInterval(() => a1(), 1000)
Just a convoluted way to get a warning with a stacktrace. I feel like very tall messages are leading to this issue. To be confirmed.
Note that if your toolbox is very tall (eg 1000px tall), you might not reproduce the issue.
Reporter | ||
Comment 1•3 years ago
|
||
This seems related to the intersection observer at https://searchfox.org/mozilla-central/rev/1f617334179cf28b4b310d1d116ddbc8ef3348ea/devtools/client/webconsole/components/Output/ConsoleOutput.js#99
this.lastMessageIntersectionObserver = new IntersectionObserver(
entries => {
for (const entry of entries) {
// Consider that we're not pinned to the bottom anymore if the last message is
// less than half-visible.
this.scrolledToBottom = entry.intersectionRatio >= 0.5;
}
},
{ root: this.outputNode, threshold: [0.5] }
);
Tall messages will consistently fail this check depending on the toolbox' height.
oh right, I never thought of this like that but if the observed element is taller than the root, it will impact the intersectionRatio (as well as how the observer callback will be called in regard to the defined thresholds)
At some point I tried having a dedicated invisible element at the bottom of the console output that would serve as the observed element instead of observing messages, I may try that again
Reporter | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
This fixes the test included in the patch. However, it makes no guarantees to not
break other things without the virtualization patch, which changes this to observe
the bottom buffer element instead of the last message.
Comment 6•3 years ago
|
||
bugherder |
Description
•