I.e., it does something even if the first subtask is hidden because it's
complete or something.
return target as HTMLElement;
},
return target as HTMLElement;
},
- firstVisibleTask: function () {
- for (const task of document.getElementsByClassName("task")) {
+ firstVisibleTask: function (root: Element | null = null) {
+ if (root === null) root = document.body;
+ for (const task of root.getElementsByClassName("task")) {
const state = task.getAttribute("data-state");
if (
task instanceof HTMLElement &&
const state = task.getAttribute("data-state");
if (
task instanceof HTMLElement &&
},
moveCursorRight: function () {
},
moveCursorRight: function () {
- (this.currentTask()?.getElementsByClassName("task")[0] as HTMLElement)?.focus();
+ const active = this.currentTask();
+ if (!active) return false;
+ (this.firstVisibleTask(active) as HTMLElement | null)?.focus();
},
moveCursorVertically: function (offset: number): boolean {
},
moveCursorVertically: function (offset: number): boolean {