Skip to content

Fix checkbox interaction for indented (nested) task list items#1118

Open
zwarm wants to merge 3 commits intotrunkfrom
dodroid-954-checklist-issue
Open

Fix checkbox interaction for indented (nested) task list items#1118
zwarm wants to merge 3 commits intotrunkfrom
dodroid-954-checklist-issue

Conversation

@zwarm
Copy link
Contributor

@zwarm zwarm commented Mar 13, 2026

Fix

Fix checkbox interaction for indented (nested) task list items.

Note

This PR can be tested with DayOne-Android via the companion PR here

Three issues were addressed:

  1. Cannot check indented items: The x-coordinate gate in AztecText.onTouchEvent() and TaskListClickHandler only allowed taps within a single leading margin width, rejecting taps on nested checkboxes positioned further right. The handler now computes the tap boundary based on the nesting depth of the tapped item.
  2. Checking item above indented item checks both: isChecked() in AztecTaskListSpan fetched all AztecListItemSpan children (including nested ones) but used a line index that only counted direct children, causing an index mismatch. Now filters spans by nestingLevel to match.
  3. Wrong item gets strikethrough: Same root cause as TagSoup fixes HTML when there is no root node #2 — after any nested item, every subsequent checkbox rendered the state of the wrong item.

Test Steps

  1. Check out the branch dodroid-954-checklist-issue
  2. Build and run the sample app
  3. Create a task list with a few items
  4. Indent one item in the middle using the indent toolbar button
  5. Tap the checkbox on the indented item — it should toggle independently
  6. Tap the checkbox on the item directly above the indented item — only that item should be checked
  7. Tap the checkbox on the item directly below the indented item — the correct item should be checked and struck through
  8. Verify items at all positions (above, below, indented) can be checked and unchecked independently

Make sure strings will be translated:

  • If there are new strings that have to be translated, I have added them to the client's strings.xml as a part of the integration PR.

zwarm added 3 commits March 13, 2026 13:17
…item spans by nesting level in isChecked() so the line index aligns with direct children only, matching how getIndexOfProcessedLine() counts them. Without this, nested items shift the index and cause checkboxes to render the wrong state.
  Select the innermost AztecTaskListSpan at the tap position instead of an arbitrary one, and compute the x-coordinate boundary based on nesting depth so taps on indented checkboxes are recognized.
  The previous check rejected taps beyond a single leading margin width, preventing interaction with indented checkboxes. The handler now performs its own nesting-aware check, so the outer gate only needs to verify the editor is enabled.
@zwarm zwarm added the bug label Mar 13, 2026
@zwarm zwarm requested a review from planarvoid March 13, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant