I'm working on a javascript UI which assumes that there are a certain grid elements that need to be looked-at/examined by the user and then a confirmation shall pop up to query user's intentions and carry them out accordingly.
The code goes something like this:
elements.forEach(x => {
x.style.backgroundColor = "red";
x.scrollIntoView();
let r = confirm("Do you wish to alter element?");
//function code
});
Once the code is executed, window.confirm
doesn't wait for the element style changes to complete and for the element itself to be scrolled into view.
Is there a workaround for this behavior of window.confirm
?