[PR #2007] [MERGED] fix(editor): make sure checkbox lists are unique #5405

Closed
opened 2026-04-16 13:37:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2007
Author: @kolaente
Created: 12/19/2025
Status: Merged
Merged: 12/19/2025
Merged by: @kolaente

Base: mainHead: reimplement-checkbox


📝 Commits (10+)

  • 65962cd chore: add nanoid dependency for unique task item IDs
  • 4542d3c feat(editor): add TaskItemWithId extension with unique ID support
  • c76a32a test(editor): add unit tests for TaskItemWithId extension
  • 1e4d478 fix(editor): use TaskItemWithId for reliable checkbox toggling
  • 63cfc7c feat(helpers): add getCheckboxesWithIds function
  • 14ba8df fix(editor): regenerate duplicate taskIds when splitting checkbox items
  • e6f68af feat: add more tests to checkbox id parsing
  • ebac5c5 test(e2e): add backwards compatibility test for checkbox persistence
  • caf7135 refactor(helpers): remove unused getCheckboxesWithIds function
  • c011464 chore: remove plan file from git (should not be committed)

📊 Changes

6 files changed (+308 additions, -12 deletions)

View changed files

📝 frontend/package.json (+1 -0)
📝 frontend/pnpm-lock.yaml (+7 -4)
📝 frontend/src/components/input/editor/TipTap.vue (+27 -8)
frontend/src/components/input/editor/taskItemWithId.test.ts (+137 -0)
frontend/src/components/input/editor/taskItemWithId.ts (+82 -0)
📝 frontend/tests/e2e/task/task.spec.ts (+54 -0)

📄 Description

Summary

  • Fixes checkbox persistence bug where toggling one checkbox would affect others with identical text
  • Adds unique data-task-id attribute to each task list item for reliable identification
  • Implements ProseMirror plugin to detect and regenerate duplicate IDs when splitting items

Problem

When users created checkboxes by pressing Enter, TipTap would copy all attributes from the original node including the taskId. This caused multiple checkboxes to share the same ID, making them all toggle together when clicking any one of them.

Solution

  1. TaskItemWithId extension (taskItemWithId.ts): Custom TipTap extension that adds unique data-task-id attributes to task items
  2. ProseMirror plugin: Detects and regenerates duplicate IDs after any document change
  3. Updated checkbox handler: Matches checkboxes by taskId instead of node reference

Test plan

  • Unit tests for TaskItemWithId extension (5 tests)
  • Verified with Playwright that newly created checkboxes get unique IDs
  • Verified clicking one checkbox only affects that item
  • Verified checkbox states persist after page refresh
  • All 718 unit tests pass

Fixes #293, #563

🐰 With nanoid's magic and IDs so fine,
Each checkbox now knows which line is mine,
No more lost state when the page reloads—
Tasks persist through every browser node!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2007 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 12/19/2025 **Status:** ✅ Merged **Merged:** 12/19/2025 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `reimplement-checkbox` --- ### 📝 Commits (10+) - [`65962cd`](https://github.com/go-vikunja/vikunja/commit/65962cd6aa46f8a98083289bb665d46f8cbb3cfc) chore: add nanoid dependency for unique task item IDs - [`4542d3c`](https://github.com/go-vikunja/vikunja/commit/4542d3ce7c4bf036737722261b655ba1f2b9a4c1) feat(editor): add TaskItemWithId extension with unique ID support - [`c76a32a`](https://github.com/go-vikunja/vikunja/commit/c76a32ad1dbea0568ff6a718953dba4c7cdf7ea1) test(editor): add unit tests for TaskItemWithId extension - [`1e4d478`](https://github.com/go-vikunja/vikunja/commit/1e4d47880da3bc504de6dbff8acb35c83cfe7c88) fix(editor): use TaskItemWithId for reliable checkbox toggling - [`63cfc7c`](https://github.com/go-vikunja/vikunja/commit/63cfc7cd9273f291a42ceced83ea87b60a3b3819) feat(helpers): add getCheckboxesWithIds function - [`14ba8df`](https://github.com/go-vikunja/vikunja/commit/14ba8df154ee4d19a95b6f21d9c9148ec2dc8f83) fix(editor): regenerate duplicate taskIds when splitting checkbox items - [`e6f68af`](https://github.com/go-vikunja/vikunja/commit/e6f68af405d2931ef2fb9ebc1bcf39cb5c11b18f) feat: add more tests to checkbox id parsing - [`ebac5c5`](https://github.com/go-vikunja/vikunja/commit/ebac5c5cc34747f6e76067af7bf2f872279b0ae9) test(e2e): add backwards compatibility test for checkbox persistence - [`caf7135`](https://github.com/go-vikunja/vikunja/commit/caf7135a50d1ba5bce16e5a4bcc3e718ce788f0b) refactor(helpers): remove unused getCheckboxesWithIds function - [`c011464`](https://github.com/go-vikunja/vikunja/commit/c011464b2f21cb2c50921558739d17641d08cc50) chore: remove plan file from git (should not be committed) ### 📊 Changes **6 files changed** (+308 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `frontend/package.json` (+1 -0) 📝 `frontend/pnpm-lock.yaml` (+7 -4) 📝 `frontend/src/components/input/editor/TipTap.vue` (+27 -8) ➕ `frontend/src/components/input/editor/taskItemWithId.test.ts` (+137 -0) ➕ `frontend/src/components/input/editor/taskItemWithId.ts` (+82 -0) 📝 `frontend/tests/e2e/task/task.spec.ts` (+54 -0) </details> ### 📄 Description ## Summary - Fixes checkbox persistence bug where toggling one checkbox would affect others with identical text - Adds unique `data-task-id` attribute to each task list item for reliable identification - Implements ProseMirror plugin to detect and regenerate duplicate IDs when splitting items ## Problem When users created checkboxes by pressing Enter, TipTap would copy all attributes from the original node including the `taskId`. This caused multiple checkboxes to share the same ID, making them all toggle together when clicking any one of them. ## Solution 1. **TaskItemWithId extension** (`taskItemWithId.ts`): Custom TipTap extension that adds unique `data-task-id` attributes to task items 2. **ProseMirror plugin**: Detects and regenerates duplicate IDs after any document change 3. **Updated checkbox handler**: Matches checkboxes by `taskId` instead of node reference ## Test plan - [x] Unit tests for TaskItemWithId extension (5 tests) - [x] Verified with Playwright that newly created checkboxes get unique IDs - [x] Verified clicking one checkbox only affects that item - [x] Verified checkbox states persist after page refresh - [x] All 718 unit tests pass Fixes #293, #563 > 🐰 With nanoid's magic and IDs so fine, Each checkbox now knows which line is mine, No more lost state when the page reloads— Tasks persist through every browser node! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 13:37:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5405