Skip to content

[BUG] Content Drive: hide Upload button when items are selected #36369

Description

@zJaaal

Problem Statement

While doing QA on Content Drive, the Upload button stays visible even when one or more items are selected in the content grid. If the user selects a folder and then uploads an asset, the asset is stored in the root folder instead of the selected one. From a user's perspective this is unintuitive: the selection implies an action context, but the upload silently ignores it and lands the asset somewhere unexpected.

The toolbar already establishes the correct pattern for this: when items are selected ($showWorkflowActions = selectedItems().length > 0), the "Add New" button is hidden and the workflow / bulk actions are swapped in. The Upload button was simply left out of that swap and is hardcoded as always-visible, so it remains clickable in a selection context where it doesn't belong.

Decision (agreed in Slack with Rafael Velazco, Melissa Rojas, and Jalinson Diaz): rather than redirecting the upload target to the selected folder — which would couple a spatial drag-and-drop gesture to a checkbox selection and introduce ambiguous UX — the Upload button should be hidden whenever there is any selection, consistent with how the "Add New" button already behaves. To upload into a specific folder, the user navigates into it (which sets the current folder) and uploads with no selection active.

Impact: Low severity, but a recurring source of confusion. Assets can end up in the wrong location with no clear indication of why.

Browser & OS: Reproducible in Chrome / macOS (browser-agnostic; pure front-end behavior).

Steps to Reproduce

  1. Go to Content Drive.
  2. Navigate to any folder context (e.g. site root).
  3. Select a folder (or any item) in the content grid via its checkbox/row selection.
  4. Note the Upload button is still visible in the toolbar.
  5. Click Upload and upload an asset.
  6. Observe: the asset is stored in the root/current folder, not the selected folder — and the Upload button should not have been available in this selection context in the first place.

Acceptance Criteria

  • When no items are selected, the Upload button is visible and behaves as today (uploads to the current/navigated folder).
  • When one or more items are selected (folders or content), the Upload button is hidden, consistent with the existing "Add New" button behavior.
  • The Upload button's hide/show transition uses the same animation pattern as the "Add New" button (no visual jank when toggling selection).
  • Drag-and-drop and upload-target logic are unchanged — only the Upload button's visibility is affected.
  • When the selection is cleared, the Upload button reappears.
  • Unit tests cover: button visible with empty selection, hidden with a single selection, and hidden with multiple selections.

dotCMS Version

Latest from main branch.

Severity

Low - Minor issue or cosmetic

Links

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions