From b8bca6bacf0137f04b0191530e4cb63a5373a124 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 22 Feb 2026 13:20:29 +0800 Subject: [PATCH] fix(web): scope task list item index to memo content container The closest() selector was targeting a CSS class that never existed on the container, causing fallback to document.body and collecting task items across all visible memos. This caused index collisions when multiple memos with todo lists were on the page. Adds data-memo-content attribute to the container and updates the selector accordingly. Fixes #5635 --- web/src/components/MemoContent/TaskListItem.tsx | 2 +- web/src/components/MemoContent/index.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/components/MemoContent/TaskListItem.tsx b/web/src/components/MemoContent/TaskListItem.tsx index a76e7afe5..94545ebb3 100644 --- a/web/src/components/MemoContent/TaskListItem.tsx +++ b/web/src/components/MemoContent/TaskListItem.tsx @@ -38,7 +38,7 @@ export const TaskListItem: React.FC = ({ checked, node: _node // Fallback: Calculate index by counting all task list items in the entire memo // We need to search from the root memo content container, not just the nearest list // to ensure nested tasks are counted in document order - let searchRoot = listItem.closest('[class*="memo-content"], [class*="MemoContent"]'); + let searchRoot = listItem.closest("[data-memo-content]"); // If memo content container not found, search from document body if (!searchRoot) { diff --git a/web/src/components/MemoContent/index.tsx b/web/src/components/MemoContent/index.tsx index b60ffffe6..bcacd67f1 100644 --- a/web/src/components/MemoContent/index.tsx +++ b/web/src/components/MemoContent/index.tsx @@ -38,6 +38,7 @@ const MemoContent = (props: MemoContentProps) => {
*:last-child]:mb-0",