Bug 2019800 - Avoid unnecessary scrolling upon job clicks#9266
Bug 2019800 - Avoid unnecessary scrolling upon job clicks#9266Rob--W wants to merge 3 commits intomozilla:masterfrom
Conversation
4f380b0 to
deb3ff3
Compare
|
CI is red but that has nothing to do with my changes. All other recent PRs have the same error. Details |
deb3ff3 to
8aca781
Compare
|
The original version of the patch is not good enough to fully fix the reported issue. To figure out why the element kept scrolling upon clicking the button, I intercepted the {
let es = Element.prototype.scrollIntoView;
Element.prototype.scrollIntoView = function (...a) {
debugger;
return es.apply(this, a);
};
}Then I clicked on the button while the DevTools was open in a separate window. The breakpoint triggered here: treeherder/ui/hooks/useJobButtonRegistry.js Lines 128 to 129 in d43d586 That logic appears to have been added in #9180, without prior history for the logic. I think that the most sensible thing to do here is to call the fixed version that I introduced in this PR. |
useJobButtonRegistry calls scrollIntoView, but that should be scrollToElement to avoid unnecessary jumps upon click on a job button. Since the job.js file already references useJobButtonRegistry.js, and circular dependencies are better avoided, this commit moves the scrollToElement function to a new file, and updates the existing call sites to import from the new file.
8aca781 to
fdab49e
Compare
|
Unit tests appear to fail, suggesting that Output of test run: Details |
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=2019800 (see bug for analysis).
The bug was introduced 7 years ago by #5293 .
Surprisingly, the selectors for querySelector from the version of the code before PR 5293 are still valid, and are being re-introduced by this patch.