Skip to content

feat(files): support Ctrl+A select-all in the file list - #19682

Open
ousugo wants to merge 1 commit into
CherryHQ:mainfrom
ousugo:feat/files-select-all-shortcut
Open

feat(files): support Ctrl+A select-all in the file list#19682
ousugo wants to merge 1 commit into
CherryHQ:mainfrom
ousugo:feat/files-select-all-shortcut

Conversation

@ousugo

@ousugo ousugo commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Before this PR:

  • The Files page offers select-all only through the header checkbox; there is no keyboard shortcut for it.

After this PR:

  • Pressing Ctrl+A (Cmd+A on macOS) in the Files page list view selects every file in the current filtered view, with the same effect as checking the header select-all checkbox.
  • The shortcut is guarded the same way as the page's existing Delete/F2 shortcuts: it does nothing while an input, text field, or other interactive control has focus (native text select-all is preserved), and it stays inert in the image grid view, which has no selection model.

Related to #9616 (file-management batch operations, closed as completed when the batch-selection UI shipped — this PR completes it with a keyboard select-all entry point).

Why we need it and why it was done in this way

The following tradeoffs were made:

  • Reused the existing select-all logic behind the header checkbox (handleSelectAllVisible) instead of adding a new selection path, so the checkbox and the keyboard shortcut share one owner for select-all semantics.
  • The shortcut always selects (never toggles), matching standard file-manager behavior; deselection remains available through the header checkbox.

The following alternatives were considered:

  • Handling the shortcut in the list component: rejected because selection state and the page's existing keyboard shortcuts already live on the page, making the page-level keydown handler the single owner.
  • Adding the shortcut to the image grid view: rejected for now because that view has no selection model; the branch explicitly keeps the shortcut inert there to avoid invisible selections.

Links to places where the discussion took place: N/A

Breaking changes

None.

Special notes for your reviewer

  • Regression tests cover Cmd+A on macOS, Ctrl+A outside macOS, the interactive-control guard, and the image-grid no-op path, written with userEvent.keyboard and role-based queries per docs/references/testing/frontend-testing.md.
  • The image-grid no-op test is mutation-verified: removing the !isImageGrid clause makes it fail (file.batch_trash gets called), so the guard clause is genuinely pinned.

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

Files: You can now press Ctrl+A (Cmd+A on macOS) in the file list to select all files in the current view.

Add a Ctrl+A (Cmd+A on macOS) branch to the Files page keyboard
shortcut handler, reusing the existing select-all logic behind the
header checkbox so both entry points share one owner. The shortcut
selects every file in the current filtered list view, stays inert in
the image grid (no selection model there) and while focus is inside
inputs or other interactive controls, preserving native text
select-all.

Cover the behavior with regression tests for Cmd+A on macOS, Ctrl+A
outside macOS, the interactive-control guard, and the image-grid
no-op path.

Signed-off-by: ousugo <dkzyxh@gmail.com>
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.

1 participant