Add detailed scroll position diagnostics

This commit is contained in:
Yuyao Huang 2026-05-09 14:43:29 +08:00
parent 0f1fa712a9
commit 025195be27

View File

@ -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);
}