Skip to content

fix: shift-click multi select in favorites, shares and trash views - #3472

Merged
AlexAndBear merged 2 commits into
mainfrom
fix/multi-select-favorites-shares-trash
Sep 28, 2026
Merged

AlexAndBear merged 2 commits into
mainfrom
fix/multi-select-favorites-shares-trash

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Description

Shift-click range selection (and Ctrl/Cmd-click toggling) didn't work in the favorites, shares and trash views, in both the tiles and the table view.

The file list only emits app.files.list.clicked.shift / app.files.list.clicked.meta events on click. The handlers for these events are registered by useKeyboardFileMouseActions, which was only used in the space, projects and search views. In the affected views the events were emitted without any subscriber, so nothing happened.

This PR registers useKeyboardFileNavigation and useKeyboardFileMouseActions in:

  • Favorites
  • Shared with me
  • Shared with others
  • Shared via link
  • Trash of a space (GenericTrash)

Besides shift/ctrl-click, this also enables keyboard navigation (arrow keys, Shift+Arrow, Ctrl+A, Esc) in these views. The navigation is based on the list that is actually rendered (after filtering and sorting), so arrow keys follow the visible order.

Favorites additionally gets useKeyboardFileActions (Ctrl+C), matching the search results list. The shares and trash views don't, because the copy action is hidden for share, trash and space resources there.

The trash overview is not selectable (is-selectable="false"), so it's unchanged.

Because keyboard navigation is now active in more views, this PR also fixes two existing bugs in useKeyboardFileNavigation that happen when nothing has been selected yet (latestSelectedId is null):

  • Shift+ArrowUp/Down in tiles view threw a TypeError, because getVerticalProperties() called .toString() on null. It now returns early.
  • Space called toggleSelection(null), which added null to selectedIds. It now does nothing.

Related Issue

  • Fixes none (no issue has been created)

How Has This Been Tested?

  • test environment: local unit tests, type check, lint
  • test case 1: pnpm test:unit --run packages/web-app-files/tests/unit/views passes
  • test case 2: new unit tests in useKeyboardFileNavigation.spec.ts for Shift+ArrowUp/Down in tiles view and Space without a selection (they fail without the fix)
  • test case 3: vue-tsc, ESLint and Prettier pass for web-app-files
  • test case 4: not yet tested manually in the browser (shift-click and ctrl-click in tiles and table view of favorites, shares and trash)

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@tammi-23 tammi-23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR enables useKeyboardFileNavigation in five additional views, but in tile mode pressing Shift+ArrowUp/Down before selecting an item reaches getVerticalProperties() with latestSelectedId === null
and calls .toString() on it.

The defect already exists in views using this composable, but this change exposes it in Favorites, Shares and Trash as well. Pressing Space without a selection also passes null to toggleSelection().

So, in my opinion, we could just fix that directly in this PR.

@AlexAndBear
AlexAndBear merged commit 2b98e70 into main Sep 28, 2026
31 checks passed
@AlexAndBear
AlexAndBear deleted the fix/multi-select-favorites-shares-trash branch September 28, 2026 11:32
@github-project-automation github-project-automation Bot moved this from Qualification to Done in OpenCloud Team Board Sep 28, 2026
@openclouders openclouders mentioned this pull request Sep 28, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants