Skip to content

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

Open
dillardblom wants to merge 1 commit into
nextcloud:mainfrom
dillardblom:feat/fold-accounts
Open

dillardblom wants to merge 1 commit into
nextcloud:mainfrom
dillardblom:feat/fold-accounts

Conversation

@dillardblom

@dillardblom dillardblom commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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
Contributor 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
Contributor Author

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

@dillardblom

Copy link
Copy Markdown
Contributor 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
Contributor 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
Contributor 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
@dillardblom
dillardblom force-pushed the feat/fold-accounts branch 2 times, most recently from d6046e7 to 53fdb35 Compare October 5, 2026 02:37
@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
Contributor Author

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

@dillardblom

Copy link
Copy Markdown
Contributor 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.

@github-actions

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@dillardblom

Copy link
Copy Markdown
Contributor Author

@kra-mo friendly ping: the layout now follows option F as you picked it (the toggle at the end of the row, in line with a folder's disclosure arrow, mailboxes slightly indented under the account), and the conflicts with the Vue 3 migration are resolved (see above). Could you have another look when you find the time?

Two questions from your first review are still open: whether this should become a reusable collapsible header in nextcloud-vue (@ShGKme), and whether to keep "Collapse folders". This PR leaves "Collapse folders" as it is; I'm happy to follow up on either in a separate change.

@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.

@dillardblom yeah sorry, I was on vacation. Looks good from a design perspective.

@kesselb

kesselb commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Please rebase your branch and squash everything into one feat commit.

Add a toggle to 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 toggle sits at the end of the row, after the actions menu, in the
same column as a folder's own disclosure arrow. The account name starts
flush with the row, lined up with the folder icons, and an account's
mailboxes are indented a little under its header. The item's own CSS
sets width: 100%, so the inset comes off that width too; a plain margin
would push the row's right edge past the list.

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 toggle, link and counter.
Each account's actions menu is labelled after the account ("Actions
for {email}"), so the menus are distinguishable for screen readers.

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>
@dillardblom

Copy link
Copy Markdown
Contributor Author

Rebased onto main and squashed into a single feat commit.

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

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