]> git.scottworley.com Git - vopamoi/blobdiff - vopamoi.ts
Start with focus on top task
[vopamoi] / vopamoi.ts
index fa55920faeec743f586734caf8ae919dc5d86d94..7497e54afbda526bbe2fa47fdd2bfa8d9d93cf2e 100644 (file)
@@ -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) {
   },
 
   focusTaskNameInput: function (event: Event) {
@@ -236,4 +238,5 @@ function handleKey(event: any) {
 function browserInit() {
   document.body.addEventListener("keydown", handleKey, { capture: false });
   log.replay();
 function browserInit() {
   document.body.addEventListener("keydown", handleKey, { capture: false });
   log.replay();
+  BrowserUI.firstVisibleTask()?.focus();
 }
 }