mirror of
git://git.yoctoproject.org/yocto-autobuilder2.git
synced 2025-07-04 20:54:48 +02:00
releaseselector: Fix page scroll on selector use
When using selectors, all fields modified by the selector will be successively focused, inducing a potential page scroll. Save current scroll before applying the release selector and set back this scroll once the selector has been applied, setting back the page at the same position. Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
62d5d77167
commit
a89c199e30
|
@ -117,6 +117,13 @@ buildbotSetupPlugin((reg) => {
|
|||
* Apply values from the selected field selector
|
||||
*/
|
||||
async function applySelector(selector, selectorName) {
|
||||
const modalBody = document.getElementsByClassName("modal-body")[0];
|
||||
let scrolltop = 0, scrollleft = 0;
|
||||
if (modalBody) {
|
||||
scrolltop = modalBody.scrollTop;
|
||||
scrollleft = modalBody.scrollLeft;
|
||||
}
|
||||
|
||||
for (let [field, value] of Object.entries(selector)) {
|
||||
const input = inputRefs.get('force-field-' + field);
|
||||
if (input && input.value != value) {
|
||||
|
@ -132,6 +139,16 @@ buildbotSetupPlugin((reg) => {
|
|||
const releaseSelector = inputRefs.get('force-field-branchselector');
|
||||
releaseSelector.parentNode.previousSibling.textContent = selectorName;
|
||||
releaseSelector.focus();
|
||||
|
||||
/* Scroll back to the initial position. */
|
||||
if (modalBody) {
|
||||
modalBody.scroll(scrollleft, scrolltop)
|
||||
|
||||
setTimeout(() => {
|
||||
modalBody.scroll(scrollleft, scrolltop);
|
||||
}, 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue
Block a user