Skip to content

feat(media): select every visible asset with Ctrl/Cmd+A or a toolbar button - #658

Open
mostafasadeghidev wants to merge 1 commit into
CoreBunch:mainfrom
mostafasadeghidev:feat/media-select-all-visible
Open

mostafasadeghidev wants to merge 1 commit into
CoreBunch:mainfrom
mostafasadeghidev:feat/media-select-all-visible

Conversation

@mostafasadeghidev

Copy link
Copy Markdown
Contributor

Split out of #501, per review: select-all alone, on main.

What

  • Ctrl/Cmd+A selects every asset the grid shows; pressed again with everything selected, it clears the selection.
  • A toolbar All button does the same and makes the shortcut discoverable (Select all N items / Clear selection).

Why

Emptying the trash or tagging a folder's worth of uploads meant clicking every file.

Behaviour worth reviewing

  • "All" is visibleAssets — what the folder, filter and search show — never the whole library, so "select all, then delete" in the trash can't reach a live file that isn't on screen.
  • The shortcut is document-level (the grid has no tabindex). It stands down in a text field, where the browser's own select-all is meant, and while a real modal is open.
  • It keys on aria-modal="true", not role="dialog". Selecting one asset opens the viewer window, which carries the role but deliberately leaves the grid usable; keying on the role disabled the shortcut almost everywhere in Media.

Tests

selectAll.test.tsx renders MediaCanvas and presses the real shortcut and button — no copies of the logic. Each guard was checked by removing it from the component: keying on role="dialog", selecting the whole library, ignoring the search box — each turns the suite red.

Verification

bunx tsc -b                         clean
bunx eslint src/admin/pages/media   clean
bun test src/__tests__/media        all pass

Docs: one line in docs/features/media.md.

…button

Emptying the trash, or tagging a folder's worth of uploads, meant clicking
every file. Ctrl/Cmd+A now selects every asset the grid shows, and a
toolbar button makes the shortcut discoverable. Both toggle: when the
selection already covers everything visible, they clear it.

"Everything" is `visibleAssets` — what the folder, filter and search have
narrowed to — not the whole library, so "select all, then delete" in the
trash can never reach a live file off screen.

The shortcut is document-level (the grid has no tabindex) and stands down
in a text field, where the browser's own select-all is meant, and while a
real modal is open. It keys on `aria-modal`, not `role="dialog"`: selecting
one asset opens the viewer window, which carries the role but leaves the
grid usable, and keying on the role turned the shortcut off almost
everywhere in Media.

The tests render MediaCanvas and press the real shortcut and button; each
guard was checked against a component with it removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mostafasadeghidev added a commit to mostafasadeghidev/Instatic that referenced this pull request Oct 16, 2026
…hat render the canvas

The stack already had select-all, extracted into `useMediaSelection`. The
merge also dropped a second copy of it into MediaCanvas — a second
document keydown listener would have selected and then cleared on one
Ctrl/Cmd+A — so that copy is removed and MediaCanvas is unchanged by this
merge. CoreBunch#658's tests, which render MediaCanvas and press the real shortcut,
replace CoreBunch#501's tests of local copies, and pass against the hook unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mostafasadeghidev added a commit to mostafasadeghidev/Instatic that referenced this pull request Oct 16, 2026
…ch#501 is now three PRs

CoreBunch#335 and CoreBunch#499 move to the landed table (shipped in v0.0.21). CoreBunch#501 was
closed in review and asked to come back split: its rows become CoreBunch#658
(select-all), CoreBunch#659 (upload queue stays closed) and CoreBunch#660 (minimize). The
three parts of CoreBunch#501 that are in none of them — the Uploads progress label,
the queue's bottom-left default, and the Dialog body size — are listed as
carried-but-not-proposed, so the README still says what a server runs.

Also: what an installation needs before moving to plain upstream, since
upstream's 031 repeats an ALTER this branch ran as 025.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant