From 025195be2735bab08624d43299cf89fcc936cd69 Mon Sep 17 00:00:00 2001 From: Yuyao Huang Date: Sat, 9 May 2026 14:43:29 +0800 Subject: [PATCH] Add detailed scroll position diagnostics --- static/js/tasks.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/js/tasks.js b/static/js/tasks.js index 30aeccd..27ed27a 100644 --- a/static/js/tasks.js +++ b/static/js/tasks.js @@ -167,9 +167,17 @@ function scrollToTask(taskId) { const scrollViewHeight = scrollView.clientHeight; const taskHeight = taskElement.offsetHeight; const targetScrollTop = taskTop - (scrollViewHeight / 2) + (taskHeight / 2); - console.log("Scrolling to:", targetScrollTop, "element offsetTop:", taskTop); + console.log("scrollViewHeight:", scrollViewHeight, "taskHeight:", taskHeight); + console.log("taskTop:", taskTop, "targetScrollTop:", targetScrollTop); scrollView.scrollTop = targetScrollTop; - console.log("scrollTop after set:", scrollView.scrollTop); + console.log("scrollTop set to:", scrollView.scrollTop); + + // Check all task positions + const allTasks = scrollView.querySelectorAll('.task-item'); + console.log("All task positions:"); + allTasks.forEach((t, i) => { + console.log(` Task ${t.dataset.taskId}: offsetTop=${t.offsetTop}, visible=${t.offsetTop >= targetScrollTop && t.offsetTop < targetScrollTop + scrollViewHeight}`); + }); } else { console.log("Task element not found for id:", taskId); }