The folder tree ignored sortOrder. It put Inbox first and everything else A–Z, so Sent ended up among ordinary folders. With 88 folders, as in #402, that puts it near the bottom.
Order. Inbox first, then any order the user has chosen (sortOrder), then the other special folders in the usual order (Drafts, Sent, Archive, Junk, Trash), then the rest A–Z. Stalwart gives every folder sortOrder 0 until someone orders it, so every existing sidebar changes once, to special folders first.
Drag between rows. Dropping a folder on the top or bottom quarter of a row puts it above or below that row, and a line shows where it will land. Dropping on the middle still nests it, as before.
Special folders can be dragged now, to reorder them. They still can't be nested, since the server won't reparent them. On those rows the whole row reorders, by the nearer half. Inbox stays first, and nothing can be dropped above it.
Move up / Move down in the folder menu, for the keyboard and touch. Each step skips folders that are hidden from the list, so every step visibly moves the folder.
Saving. A reorder numbers the level 10 apart and writes only the folders whose number changed, in one Mailbox/set (arrangeMailboxes). The order lives on the server, so it follows the account to every device and to other JMAP clients that honor sortOrder. I checked in Stalwart's mailbox/set.rs that it accepts sortOrder on role folders, and that folders nobody has ordered report 0.
The ordering and placement logic is in lib/mailbox/folderOrder.ts. The store's childrenOf uses the same comparator. The folder pickers and the Folders settings page still list by full path, which is a different job.
Adds none. "Move up" and "Move down" were already in every catalog. The fallback count is unchanged at 16.
Testing
folderOrder.test.ts covers the default order, saved order winning, numbering and minimal writes, dropping in place, moving across levels, the rules for special folders and Inbox, rights, and Move up/down skipping hidden folders.
folder-reorder.test.tsx drives the real MailboxTree: a drop on the top edge reorders, a drop on the middle nests, a special folder reorders by the nearer half, and nothing drops above Inbox.
npm test (web and server) and npm run typecheck pass.
Checked in Chrome against npm run dev:mock: the new default order; Move up; Deleted Items dragged above Drafts; Newsletters dropped on the middle of Work (nested); Archive dropped below Junk; a drop above Inbox refused. The order survived a reload.
Known limit: a folder nested by dragging onto the middle of another keeps its old sortOrder, so it can land anywhere among its new siblings until it's reordered.
## Summary
The folder tree ignored `sortOrder`. It put Inbox first and everything else A–Z, so Sent ended up among ordinary folders. With 88 folders, as in #402, that puts it near the bottom.
- **Order.** Inbox first, then any order the user has chosen (`sortOrder`), then the other special folders in the usual order (Drafts, Sent, Archive, Junk, Trash), then the rest A–Z. Stalwart gives every folder `sortOrder` 0 until someone orders it, so **every existing sidebar changes once**, to special folders first.
- **Drag between rows.** Dropping a folder on the top or bottom quarter of a row puts it above or below that row, and a line shows where it will land. Dropping on the middle still nests it, as before.
- **Special folders can be dragged now,** to reorder them. They still can't be nested, since the server won't reparent them. On those rows the whole row reorders, by the nearer half. Inbox stays first, and nothing can be dropped above it.
- **Move up / Move down** in the folder menu, for the keyboard and touch. Each step skips folders that are hidden from the list, so every step visibly moves the folder.
- **Saving.** A reorder numbers the level 10 apart and writes only the folders whose number changed, in one `Mailbox/set` (`arrangeMailboxes`). The order lives on the server, so it follows the account to every device and to other JMAP clients that honor `sortOrder`. I checked in Stalwart's `mailbox/set.rs` that it accepts `sortOrder` on role folders, and that folders nobody has ordered report 0.
The ordering and placement logic is in `lib/mailbox/folderOrder.ts`. The store's `childrenOf` uses the same comparator. The folder pickers and the Folders settings page still list by full path, which is a different job.
## Related issues
Fixes #402
## Translations
Adds none. "Move up" and "Move down" were already in every catalog. The fallback count is unchanged at 16.
## Testing
- `folderOrder.test.ts` covers the default order, saved order winning, numbering and minimal writes, dropping in place, moving across levels, the rules for special folders and Inbox, rights, and Move up/down skipping hidden folders.
- `folder-reorder.test.tsx` drives the real `MailboxTree`: a drop on the top edge reorders, a drop on the middle nests, a special folder reorders by the nearer half, and nothing drops above Inbox.
- `npm test` (web and server) and `npm run typecheck` pass.
- Checked in Chrome against `npm run dev:mock`: the new default order; Move up; Deleted Items dragged above Drafts; Newsletters dropped on the middle of Work (nested); Archive dropped below Junk; a drop above Inbox refused. The order survived a reload.
Known limit: a folder nested by dragging onto the middle of another keeps its old `sortOrder`, so it can land anywhere among its new siblings until it's reordered.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
**Merged** 2026-09-19 as coffey-labs/ihasmail@bc366ac047ca
<sub>Rebuilt from: git history, session transcript.</sub>
This repo is archived. You cannot comment on issues.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The folder tree ignored
sortOrder. It put Inbox first and everything else A–Z, so Sent ended up among ordinary folders. With 88 folders, as in #402, that puts it near the bottom.sortOrder), then the other special folders in the usual order (Drafts, Sent, Archive, Junk, Trash), then the rest A–Z. Stalwart gives every foldersortOrder0 until someone orders it, so every existing sidebar changes once, to special folders first.Mailbox/set(arrangeMailboxes). The order lives on the server, so it follows the account to every device and to other JMAP clients that honorsortOrder. I checked in Stalwart'smailbox/set.rsthat it acceptssortOrderon role folders, and that folders nobody has ordered report 0.The ordering and placement logic is in
lib/mailbox/folderOrder.ts. The store'schildrenOfuses the same comparator. The folder pickers and the Folders settings page still list by full path, which is a different job.Related issues
Fixes #402
Translations
Adds none. "Move up" and "Move down" were already in every catalog. The fallback count is unchanged at 16.
Testing
folderOrder.test.tscovers the default order, saved order winning, numbering and minimal writes, dropping in place, moving across levels, the rules for special folders and Inbox, rights, and Move up/down skipping hidden folders.folder-reorder.test.tsxdrives the realMailboxTree: a drop on the top edge reorders, a drop on the middle nests, a special folder reorders by the nearer half, and nothing drops above Inbox.npm test(web and server) andnpm run typecheckpass.npm run dev:mock: the new default order; Move up; Deleted Items dragged above Drafts; Newsletters dropped on the middle of Work (nested); Archive dropped below Junk; a drop above Inbox refused. The order survived a reload.Known limit: a folder nested by dragging onto the middle of another keeps its old
sortOrder, so it can land anywhere among its new siblings until it's reordered.🤖 Generated with Claude Code
Merged 2026-09-19 as coffey-labs/ihasmail@bc366ac047
Rebuilt from: git history, session transcript.