Skip to content

fix(fileBrowser): exclude non-selectable system utility tiles from batch selection operations - #2545

Open
AuDevTist1C wants to merge 1 commit into
Acode-Foundation:mainfrom
AuDevTist1C:fix/file-browser-non-selectable-tiles
Open

fix(fileBrowser): exclude non-selectable system utility tiles from batch selection operations#2545
AuDevTist1C wants to merge 1 commit into
Acode-Foundation:mainfrom
AuDevTist1C:fix/file-browser-non-selectable-tiles

Conversation

@AuDevTist1C

Copy link
Copy Markdown
Contributor

📌 Summary

This pull request introduces explicit safeguards across the file browser template and interaction handlers to isolate non-selectable system utility tiles (e.g., "Add a storage" prompts and "Select document" system actions) from batch selection modes and multi-item operations.


🔎 Problem & Context

In the file browser component, system utility notifications and action triggers reside in the exact same DOM list container (.tile:not(.selection-header)) alongside standard user files and directories. Previously, enabling selection mode or performing batch actions (such as toggling all checkboxes or clicking across items) would inadvertently select these utility items.

Because these utility tiles lack valid file path URLs or context data expected by batch action handlers, including them in the selection pool resulted in runtime exceptions and unexpected behaviors during batch operations (e.g., bulk moving, deleting, or archive operations).


🛠️ Key Changes

  1. Handlebar Template Update (src/pages/fileBrowser/list.hbs):

    • Extended the list item template contract to render a data-not-selectable HTML dataset attribute whenever the item context defines {{#notSelectable}}.
  2. System Utility Tile Configuration (src/pages/fileBrowser/fileBrowser.js):

    • Updated the metadata payload for system utility tiles—specifically the "Add a storage" action (strings["add a storage"]) and the "Select document" document picker action—to pass notSelectable: true during initialization.
  3. Selection Handler Guards (src/pages/fileBrowser/fileBrowser.js):

    • Selection Mode Initialization: Updated list item iterations during selection mode activation to check for item.dataset.notSelectable != null and bypass checkbox creation/injection for utility tiles.
    • Touch & Click Delegation: Guarded click handlers in selection mode by evaluating $el2?.dataset.notSelectable != null and returning early. This prevents utility item state toggling, checkbox interaction, and invalid URL accumulation within the selectedItems tracking set.

🧪 Verification & Testing Steps

  1. Open the File Browser view.
  2. Enter Selection Mode.
  3. Verify that the "Add a storage" and "Select document" tiles do not display active selection checkboxes and cannot be toggled.
  4. Select all items in the list and perform batch actions (delete, copy); verify that no runtime errors occur and utility tiles remain unselected.

📂 File Changes Breakdown

  • src/pages/fileBrowser/fileBrowser.js: Added guards checking dataset.notSelectable in selection initialization and click handlers, and flagged utility folders with notSelectable: true.
  • src/pages/fileBrowser/list.hbs: Added the conditional {{#notSelectable}}data-not-selectable{{/notSelectable}} attribute definition to template rendered items.

(PR name and description are AI generated (Gemini 3.6 Flash))

… tiles during batch operations

Add non-selectable element safeguards across templates and touch selection handlers to prevent system utility tiles from being highlighted, checked, or included in multi-item batch actions.

System notification tiles, such as "Add a storage" prompts and "Select document" system actions, reside in the same DOM list container as regular files and directories. Previously, initiating a "Select All" command or dragging across the file list would accidentally select these utility items, triggering runtime errors during batch operations like deletion or moving.

* **Template Contract (`src/pages/fileBrowser/list.hbs`):**
  * Added support for the `data-not-selectable` HTML dataset attribute flag on list item nodes.
* **Tile Configuration:**
  * Explicitly configured system utility tiles ("add a storage" and "Select document") with `notSelectable: true` in their template render context.
* **Selection Safeguards (`src/pages/fileBrowser/fileBrowser.js`):**
  * Updated touch event delegation, long-press handlers, and "Select All" toggle utility functions to check for `dataset.notSelectable != null`.
  * Items flagged as non-selectable are automatically bypassed during selection count updates, bulk checkboxes, and context action payload generation.

(AI generated commit message)
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prevents file-browser system utility tiles from participating in batch selection.

  • Marks “Add a storage” and “Select document” tiles as non-selectable.
  • Renders the marker as a data attribute in the list template.
  • Skips marked tiles during checkbox creation and selection-mode click handling.

Confidence Score: 5/5

The PR appears safe to merge with no actionable selection-path regressions identified.

The utility-tile metadata reaches the rendered DOM, both direct selection paths skip marked tiles, and select-all only processes tiles that received checkboxes.

Important Files Changed

Filename Overview
src/pages/fileBrowser/fileBrowser.js Adds and consistently enforces non-selectable metadata for utility tiles across individual and select-all interaction paths.
src/pages/fileBrowser/list.hbs Emits the data attribute consumed by the new selection guards.

Reviews (1): Last reviewed commit: "fix: introduce non-selectable item handl..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants