Skip to content

feat(ui): allow folding an account to a single line - #13736

Open
dillardblom wants to merge 5 commits into
nextcloud:mainfrom
dillardblom:feat/fold-accounts
Open

dillardblom wants to merge 5 commits into
nextcloud:mainfrom
dillardblom:feat/fold-accounts

Conversation

@dillardblom

@dillardblom dillardblom commented Sep 27, 2026 •

Copy link
Copy Markdown

Closes #9300

Summary

With several accounts, the navigation stays long even with "Collapse folders", because the inbox, favourites, drafts, sent and trash of every account remain visible. This adds a chevron in front of every account to fold it to a single line:

  • A folded account hides all its mailboxes and shows the number of unread messages in its inbox next to its name.
  • The account name links to the account's inbox, so you can switch between accounts without unfolding them. Other folders are still reached by unfolding the account.
  • While its inbox is open, a folded account is highlighted like an active navigation entry.
  • Account headers that directly follow each other have no extra spacing, so a list of folded accounts stays compact.
  • The folded state is stored per account in the existing account-settings preference, like the collapsed state, so there is no backend change. The toggle is disabled while saving and reverts if saving fails. Creating a folder in a folded account unfolds it.
  • Saves of the account-settings preference are now queued. Every save sends the whole list, so with a toggle per account an older snapshot could otherwise overwrite a newer one when requests finish out of order. This also applies to the existing collapsed setting.

The account header is now a list item with a heading, a link and the actions menu instead of an NcAppNavigationCaption, because the caption only renders plain text and cannot hold the chevron, the link and the counter. The existing "Collapse folders" toggle is unchanged.

Not included on purpose: the unified inbox and provisioned accounts that are disabled for the current session cannot be folded or linked.

Screenshots

Unfolded (before) One account folded All accounts folded
fold-1-unfolded fold-2-one-folded fold-3-all-folded

Testing

  • Unit tests for the store (default, toggle, persistence, rollback on a failed save, unfolding on folder creation, folder creation still succeeding when saving the unfolded state fails) and for NavigationAccount (toggle state, counter and its screen reader label, inbox link, active highlight, disabled accounts).
  • Tested manually on Nextcloud 34 with Mail 5.12.2 and two IMAP accounts: folding, unfolding, the unread counter, switching accounts through the name link, the active highlight, and the state surviving a reload.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@welcome

welcome Bot commented Sep 27, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request in this repository! ✌️

@kesselb

kesselb commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Thanks for your PR 👍

@kra-mo kra-mo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature makes sense. The account name labels should be aligned with the other labels, though:

Image

Although I do wonder whether this should be done in nextcloud-vue instead? Like to have a collapsible header component we can reuse. @ShGKme?

@kra-mo

kra-mo commented Sep 29, 2026

Copy link
Copy Markdown
Member

I do also wonder whether we should keep "Collapse folders" even with this.

@kra-mo

kra-mo commented Sep 29, 2026

Copy link
Copy Markdown
Member

Or maybe the icons should be aligned to the end like for folders:

image

@dillardblom

Copy link
Copy Markdown
Author

Thanks for the review! Good point on the alignment. I made a few mockups (CSS only, same data) to compare the options before changing the code:

B: chevron at the end, like folders E: chevron at the end, folders indented under the name
mockup-B mockup-E
F: chevron at the end, name aligned with the icons D: account label instead of the address
mockup-F mockup-D
  • B follows your suggestion: the chevron moves to the end, as for folders with subfolders, and the name lines up with the folder labels.
  • E also indents the folders of the account, so the inbox icon sits under the account name. That makes it clear at a glance which folders belong to which account.
  • F moves the chevron to the end and drops the space it left at the start: the name lines up with the folder icons, so the folders sit under the name without extra indentation.
  • D shows an account label (e.g. "Personal", "Office") instead of the email address. We're working on a separate change that lets users give an account a label; showing it here would be an option the user switches on per account, with the email address remaining the default. It's not part of this PR.

My preference would be F, as it groups the folders under the account without spending horizontal space on an indent. All of these are a few lines of CSS, so I'll go with whatever you prefer.

With accounts that can be folded, "Collapse folders" might become redundant, but I'll leave that decision to you.

@kra-mo

kra-mo commented Oct 2, 2026

Copy link
Copy Markdown
Member

Yeah, seeing them like that, I think F works the best as well.

@kesselb kesselb added the AI assisted This PR contains AI-assisted commits label Oct 2, 2026
@dillardblom

Copy link
Copy Markdown
Author

Okay, I will adjust according to F and update this PR!

@dillardblom

Copy link
Copy Markdown
Author

Updated to F: the toggle now sits at the end of the row, so the account name lines up with the folder icons with no extra indentation.

@dillardblom

Copy link
Copy Markdown
Author

One correction to the F update: the toggle was still landing between the name and the actions menu. It now sits after the actions menu, so it lines up with a folder's own disclosure arrow.

@dillardblom

Copy link
Copy Markdown
Author

Pushed one more revision of F, now with a small indent so an account's mailboxes read as belonging to it rather than a flat continuation of the list. Screenshots (account names redacted):

Collapsed:
collapsed

Expanded — mailboxes indented under the account, chevron still lined up with the other accounts' (the scrollbar appearing after expanding accounts for the extra rows):
expanded

Also squashed the two follow-up fixes (toggle position, this indent) into the original commit so the history stays readable.

@dillardblom
dillardblom requested a review from kra-mo October 5, 2026 01:41
Add a chevron in front of every account in the navigation. Folding an
account hides all its mailboxes, including the inbox and the special
folders that the existing "Collapse folders" toggle keeps visible, so
many accounts fit on one screen. A folded account shows the number of
unread messages in its inbox next to its name. Account headers that
directly follow each other have no extra spacing between them.

The account name now links to the account's inbox, so switching between
accounts does not require unfolding them. Other folders are still
reached by unfolding the account. While its inbox is open, a folded
account is highlighted like an active navigation entry.

The folded state is stored per account in the existing account-settings
preference, like the collapsed state, so no backend change is needed.
The toggle is disabled while saving and reverts if saving fails.
Creating a folder in a folded account unfolds and saves it.

Saves of the account-settings preference are now queued. Each save
sends the whole list, so with a toggle per account an older snapshot
could otherwise overwrite a newer one when requests finish out of
order. This also applies to the existing collapsed setting.

The account header is now a list item with a heading, a link and the
actions menu instead of an NcAppNavigationCaption, because the caption
only renders plain text and cannot hold the chevron, link and counter.

Left out on purpose: the unified inbox and provisioned accounts that are
disabled for the current session cannot be folded or linked.

Closes nextcloud#9300

Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Dillard Blom <dillard.blom@ensembia.com>
Move the toggle to the end of the row, after the actions menu, same as
a folder's own disclosure arrow, so the two line up in the same
column. The account name now starts flush with the row, lined up with
the folder icons below it.

Indent an account's mailboxes a little under its header, so the list
reads as a hierarchy instead of a flat stack. The item's own CSS sets
width: 100%, so the inset has to come off that width too -- a plain
margin would push the row's right edge past the list and misalign its
trailing icons with the account header's.

Signed-off-by: Dillard Blom <dillard.blom@ensembia.com>
@kesselb

kesselb commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thanks @dillardblom,

could you please take a look at the conflicts. The app was migrated to vue3 and so a lot of code changed.

@dillardblom

Copy link
Copy Markdown
Author

Thanks for the reminder @kesselb, I'm going to take a look and fix it!

Port the folding to the Vue 3 migration on main: the account header
renders without the vue-frag Fragment, uses subpath imports, the
camelCase props of @nextcloud/vue 9 and NcCounterBubble's count prop,
and fetches the quota when the menu entry mounts, like main does. The
NavigationAccount spec moves to @vue/test-utils 2.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Dillard Blom <dillard.blom@ensembia.com>
Every account header has its own actions menu, and the default label
"Actions" made them indistinguishable for screen readers.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Dillard Blom <dillard.blom@ensembia.com>
@dillardblom

Copy link
Copy Markdown
Author

Conflicts with the Vue 3 migration are resolved. The account header now works without vue-frag, uses the @nextcloud/vue 9 props and subpath imports, and fetches the quota the same way main does. The component spec is ported to @vue/test-utils 2. I also gave each account's actions menu an accessible label that names the account ("Actions for {email}"), so the menus are distinguishable for screen readers. Checked again in the browser with three accounts: folding, the unread counter, the inbox link with its highlight, and the state surviving a reload.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted This PR contains AI-assisted commits enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapse mailboxes to 1 line each with display of unread messages from the inbox

3 participants