X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/5350da9f7576c4af01c7359db78e4d3f658d98dc..9f6be65ee10f3cfd4ad55b7326e8fb35fc78151a:/vopamoi.ts?ds=inline diff --git a/vopamoi.ts b/vopamoi.ts index 298e513..a98a29b 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -21,7 +21,6 @@ const Model = { task.setAttribute("tabindex", "0"); task.setAttribute("data-created", timestamp); document.getElementById("tasks")!.appendChild(task); - task.focus(); return task; }, @@ -51,12 +50,10 @@ const Model = { for (const task of document.getElementsByClassName("task")) { if (task !== target && this.getPriority(task) > priority) { task.parentElement!.insertBefore(target, task); - target instanceof HTMLElement && target.focus(); return target; } } document.getElementById("tasks")!.appendChild(target); - target instanceof HTMLElement && target.focus(); return target; }, @@ -140,6 +137,7 @@ const BrowserUI = { const input = document.getElementById("taskName"); if (input.value) { const task = UI.addTask(input.value); + if (task && task instanceof HTMLElement) task.focus(); input.value = ""; if (event.getModifierState("Control")) { this.setPriority(task, null, document.getElementsByClassName("task")[0]); @@ -212,6 +210,7 @@ const BrowserUI = { const newPriorityRounded = Math.round(newPriority); const okToRound = aPriority < newPriorityRounded && newPriorityRounded < bPriority; UI.setPriority(task.getAttribute("data-created")!, okToRound ? newPriorityRounded : newPriority, Model.getPriority(task)); + task instanceof HTMLElement && task.focus(); }, setState: function (state: string) {