Skip to content

Agent Zero AI framework

file browser dropdown fix

3clyp501880eb09d403
diff --git a/webui/components/modals/file-browser/file-browser-store.js b/webui/components/modals/file-browser/file-browser-store.js
index 5ce7f3147..8f4cc35cc 100644
--- a/webui/components/modals/file-browser/file-browser-store.js
+++ b/webui/components/modals/file-browser/file-browser-store.js
@@ -23,6 +23,7 @@ const model = {
renameMode: "rename",
isRenaming: false,
renameError: null,
+ openDropdownPath: null, // Track which dropdown is currently open
// --- Lifecycle -----------------------------------------------------------
init() {
@@ -71,6 +72,7 @@ const model = {
this.history = [];
this.initialPath = "";
this.browser.entries = [];
+ this.openDropdownPath = null;
this.resetRenameState();
},
@@ -183,6 +185,20 @@ const model = {
});
},
+ // --- Dropdown Management -------------------------------------------------
+ toggleDropdown(filePath) {
+ // Toggle: if already open, close it; otherwise open this one (closing any other)
+ this.openDropdownPath = this.openDropdownPath === filePath ? null : filePath;
+ },
+
+ isDropdownOpen(filePath) {
+ return this.openDropdownPath === filePath;
+ },
+
+ closeDropdown() {
+ this.openDropdownPath = null;
+ },
+
// --- Navigation ----------------------------------------------------------
async fetchFiles(path = "") {
this.isLoading = true;
diff --git a/webui/components/modals/file-browser/file-browser.html b/webui/components/modals/file-browser/file-browser.html
index ff5e7babf..6c531522e 100644
--- a/webui/components/modals/file-browser/file-browser.html
+++ b/webui/components/modals/file-browser/file-browser.html
@@ -61,19 +61,14 @@
<!-- Single-item actions (Edit/Rename/...) are grouped under a dropdown -->
<div
class="dropdown file-actions-dropdown"
- x-data="{
- open: false,
- toggle() { this.open = !this.open; },
- close() { this.open = false; }
- }"
- @click.outside="close()"
- @keydown.escape.window="close()"
+ @click.outside="$store.fileBrowser.closeDropdown()"
+ @keydown.escape.window="$store.fileBrowser.closeDropdown()"
>
<button
type="button"
class="btn-icon-action dropdown-trigger"
- @click.stop="toggle()"
- :aria-expanded="open.toString()"
+ @click.stop="$store.fileBrowser.toggleDropdown(file.path)"
+ :aria-expanded="$store.fileBrowser.isDropdownOpen(file.path).toString()"
aria-label="More actions"
title="More actions"
>
@@ -82,11 +77,11 @@
<div
class="dropdown-menu"
- x-show="open"
+ x-show="$store.fileBrowser.isDropdownOpen(file.path)"
x-transition
:class="{ 'bottom': $el.getBoundingClientRect().bottom > window.innerHeight - 100 }"
style="display: none;"
- @click="close()"
+ @click="$store.fileBrowser.closeDropdown()"
>
<button
type="button"