I'm currently trying to manually set focus on two buttons after each other. They are jQuery-Objects, saved in an array called pMenus. Here is the code
function OpenSubMenus(pMenus) {
pMenus[pMenus.length - 1].get(0).focus();
$(pMenus[pMenus.length - 1]).click();
if (pMenus.length == 1) {
return;
}
setTimeout(() => {
pMenus[pMenus.length - 1].get(0).blur();
pMenus.pop();
OpenSubMenus(pMenus);
}, 1000)
}
The problem is, that on the second manual .focus(), the activeElement stays on the body of the page. Has anyone encountered that problem before?
Thanks in advance.