Bugfix: autofocus was triggered when view resized

This commit is contained in:
the-djmaze 2023-02-06 08:49:56 +01:00
parent cc054054c2
commit 70e32e0905

View file

@ -79,7 +79,6 @@ const
const endShowHide = e => {
if (e.target === vmDom) {
if (vmDom.classList.contains('animate')) {
autofocus(vmDom);
vm.afterShow?.();
} else {
vmDom.close();
@ -98,6 +97,7 @@ const
vmDom.backdrop.style.zIndex = 3000 + (visiblePopups.size * 2);
}
vm.keyScope.set();
setTimeout(()=>autofocus(vmDom),1);
requestAnimationFrame(() => { // wait just before the next paint
vmDom.offsetHeight; // force a reflow
vmDom.classList.add('animate'); // trigger the transitions