]> git.scottworley.com Git - vopamoi/commitdiff
Start with focus on top task
authorScott Worley <scottworley@scottworley.com>
Wed, 26 Jan 2022 21:46:03 +0000 (13:46 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:55 +0000 (12:21 -0800)
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) {
@@ -236,4 +238,5 @@ function handleKey(event: any) {
 function browserInit() {
   document.body.addEventListener("keydown", handleKey, { capture: false });
   log.replay();
+  BrowserUI.firstVisibleTask()?.focus();
 }