fix(fileBrowser): exclude non-selectable system utility tiles from batch selection operations - #2545
Open
AuDevTist1C wants to merge 1 commit into
Conversation
… 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)
Contributor
Greptile SummaryThis PR prevents file-browser system utility tiles from participating in batch selection.
Confidence Score: 5/5The 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
Reviews (1): Last reviewed commit: "fix: introduce non-selectable item handl..." | Re-trigger Greptile |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 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
Handlebar Template Update (
src/pages/fileBrowser/list.hbs):data-not-selectableHTML dataset attribute whenever the item context defines{{#notSelectable}}.System Utility Tile Configuration (
src/pages/fileBrowser/fileBrowser.js):strings["add a storage"]) and the "Select document" document picker action—to passnotSelectable: trueduring initialization.Selection Handler Guards (
src/pages/fileBrowser/fileBrowser.js):item.dataset.notSelectable != nulland bypass checkbox creation/injection for utility tiles.$el2?.dataset.notSelectable != nulland returning early. This prevents utility item state toggling, checkbox interaction, and invalid URL accumulation within theselectedItemstracking set.🧪 Verification & Testing Steps
📂 File Changes Breakdown
src/pages/fileBrowser/fileBrowser.js: Added guards checkingdataset.notSelectablein selection initialization and click handlers, and flagged utility folders withnotSelectable: 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))