]> git.scottworley.com Git - vopamoi/blobdiff - vopamoi.ts
j/k should select something if there's no selected task
[vopamoi] / vopamoi.ts
index 0389a04c2a25f0e00305f3f0232ae366dc86c597..30efb1b2f47dc5999e1f3635be343f8ba6ed4bb0 100644 (file)
@@ -446,6 +446,7 @@ function BrowserUI() {
       var target = document.activeElement;
       if (!target) return null;
       if (target.classList.contains("tag")) target = target.parentElement!;
+      if (!target.classList.contains("task")) return null;
       return target as HTMLElement;
     },
 
@@ -525,7 +526,11 @@ function BrowserUI() {
     },
 
     moveCursorVertically: function (offset: number): boolean {
-      const active = this.currentTask();
+      let active = this.currentTask();
+      if (!active) {
+        this.firstVisibleTask()?.focus();
+        active = this.currentTask();
+      }
       if (!active) return false;
       const dest = this.visibleTaskAtOffset(active, offset);
       if (dest !== active && dest instanceof HTMLElement) {