commit 083c59c8750a53c7f47fde961c68bb9f54bb9b64
parent 3a612042844861ac690114b76ebf1ba7901e3875
Author: Hunter
Date: Sun, 8 Mar 2026 00:02:39 -0500
after deleting multiple subtasks, select subtask directly before selected chunk
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/index.html b/index.html
@@ -621,6 +621,8 @@
const toDelete = selected.filter(t => t !== taskPath[0] && t !== currentTask)
// Don't delete if it would leave the root task with no subtasks
if (toDelete.length > 0 && !(currentTask.id === 'root' && toDelete.length >= currentTask.subtasks.length)) {
+ // Find the index of the first task to delete (for post-delete selection)
+ const firstDeleteIdx = Math.min(...toDelete.map(t => currentTask.subtasks.findIndex(s => s.id === t.id)).filter(i => i !== -1))
for (const t of toDelete) {
const idx = currentTask.subtasks.findIndex(s => s.id === t.id)
if (idx !== -1) currentTask.subtasks.splice(idx, 1)
@@ -631,6 +633,8 @@
navigateToParentTask()
} else {
renderCurrentView()
+ const targetIndex = Math.max(0, firstDeleteIdx - 1)
+ selectAndFocusTask(currentTask.subtasks[targetIndex])
}
scheduleSave()
} else {