From 65a7510df0f96d4168aa33b3b3be9c6f16b2160c Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 26 Jan 2022 13:46:03 -0800 Subject: [PATCH 1/1] Start with focus on top task --- vopamoi.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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(); } -- 2.44.1