Skip to content

feat: sort checklist items A→Z from the note menu - #163

Merged
ericerkz merged 1 commit into
ericerkz:masterfrom
Mittalnew:feat/143-sort-checklist-a-z
Nov 20, 2026
Merged

ericerkz merged 1 commit into
ericerkz:masterfrom
Mittalnew:feat/143-sort-checklist-a-z

Conversation

@Mittalnew

Copy link
Copy Markdown
Contributor

Fixes #143

Summary

Adds a Sort A→Z action to the note editor's More (⋮) menu for checklist notes, as suggested in the issue. It reorders the items once by writing a new manual order, so drag and drop still works afterwards.

  • Nested items stay with their parent. Top-level items are sorted together, and children only among their siblings.
  • Completed items: with "Move completed checklist items to bottom" on, unchecked and checked items are sorted as separate groups. With it off, all items are sorted together.
  • Locale-aware comparison (Intl.Collator, using the UI locale; case-insensitive and numeric), so "Éclair" sorts with E and "Item 2" comes before "Item 10". Empty rows go last.
  • Undo/redo work like other checklist edits. The current rows are snapshotted first, so Undo also keeps text typed just before sorting.
  • The action only shows for checklists with more than one item.

Changes

  • src/app/utils/checklist-sort.ts: a new pure helper, sortChecklistItems().
  • src/app/utils/checklist-sort.test.ts: tests for the helper, plus a new test:checklist-sort npm script.
  • input.component.ts / .html: adds the sortCboxItems() action and the menu entry.
  • translations/en.json and translations/context.json: add the new input.sort_a_to_z string.

How tested

  • npm run test:checklist-sort: 4/4 pass (case/accents/numbers, nesting, completed groups, empty rows and stable ties).
  • npm run test:i18n (16/16) and npm run translations:check pass.
  • ng build succeeds.
  • Manually in Chromium: sorted a nested packing list, then used Undo and Redo, then ticked items and sorted again with completed items at the bottom. After closing the note, the saved checkBoxes order is correct.

I have read CONTRIBUTING.md and agree that my contribution is submitted under the Kept Contributor License Agreement.

Screenshots

1-before-unsorted 2-dot-menu-sort-a-z 3-after-sorted 4-sorted-with-completed-at-bottom

Adds a "Sort A→Z" action to the note editor's More (dot) menu for checklists.
It writes a new manual order once, so drag and drop keeps working afterwards.

- Nested items stay with their parent; children are sorted among siblings.
- With "Move completed checklist items to bottom" on, unchecked and checked
  items are sorted as separate groups; with it off, all items sort together.
- Locale-aware, case-insensitive and numeric comparison (Intl.Collator), so
  accented letters and "Item 2" / "Item 10" sort as expected.
- Undo/redo work like other checklist edits.

Fixes ericerkz#143
@ericerkz
ericerkz merged commit 7648620 into ericerkz:master Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: sort checklist items alphabetically

2 participants