From aada0419eb2fb75f5d7856e3787843f7e35ea845 Mon Sep 17 00:00:00 2001 From: shivangikakkar Date: Sun, 30 Sep 2018 18:17:01 +0530 Subject: [PATCH] removing event loop and using requestAnimationFrame --- src/js/popup.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/js/popup.js b/src/js/popup.js index 0226ddd..c3503b6 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -1002,11 +1002,10 @@ Logic.registerPanel(P_CONTAINER_EDIT, { document.querySelector("#edit-container-panel-name-input").value = identity.name || ""; document.querySelector("#edit-container-panel-usercontext-input").value = userContextId || NEW_CONTAINER_ID; const containerName = document.querySelector("#edit-container-panel-name-input"); - setTimeout(function() - { - containerName.focus(); - containerName.select(); - }, 0); + window.requestAnimationFrame(() => { + containerName.select(); + containerName.focus(); + }); [...document.querySelectorAll("[name='container-color']")].forEach(colorInput => { colorInput.checked = colorInput.value === identity.color; });