From: Scott Worley Date: Wed, 26 Jan 2022 21:46:03 +0000 (-0800) Subject: Start with focus on top task X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/65a7510df0f96d4168aa33b3b3be9c6f16b2160c?ds=sidebyside Start with focus on top task --- diff --git a/vopamoi.ts b/vopamoi.ts index fa55920..7497e54 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -144,10 +144,12 @@ const BrowserUI = { } }, - destroyTask: function () { - const createTimestamp = document.activeElement?.getAttribute("data-created"); - this.moveCursor(1) || this.moveCursor(-1); - return UI.destroyTask(createTimestamp!); + firstVisibleTask: function () { + for (const task of document.getElementsByClassName("task")) { + if (task instanceof HTMLElement && task.style.display !== "none") { + return task; + } + } }, focusTaskNameInput: function (event: Event) { @@ -236,4 +238,5 @@ function handleKey(event: any) { function browserInit() { document.body.addEventListener("keydown", handleKey, { capture: false }); log.replay(); + BrowserUI.firstVisibleTask()?.focus(); }