file browser dropdown fix
3clyp50 committed
Feb 5, 2026 at 10:10 UTC
1880eb09d40368391238c86b31170fb8fd980ae0
2 files changed
+22
-11
webui/components/modals/file-browser/file-browser-store.js
+16
@@ -23,6 +23,7 @@ const model = {
23
renameMode: "rename",
24
isRenaming: false,
25
renameError: null,
26
+ openDropdownPath: null, // Track which dropdown is currently open
27
28
// --- Lifecycle -----------------------------------------------------------
29
init() {
@@ -71,6 +72,7 @@ const model = {
72
this.history = [];
73
this.initialPath = "";
74
this.browser.entries = [];
75
+ this.openDropdownPath = null;
76
this.resetRenameState();
77
},
78
@@ -183,6 +185,20 @@ const model = {
185
});
186
},
187
188
+ // --- Dropdown Management -------------------------------------------------
189
+ toggleDropdown(filePath) {
190
+ // Toggle: if already open, close it; otherwise open this one (closing any other)
191
+ this.openDropdownPath = this.openDropdownPath === filePath ? null : filePath;
192
+ },
193
+
194
+ isDropdownOpen(filePath) {
195
+ return this.openDropdownPath === filePath;
196
+ },
197
+
198
+ closeDropdown() {
199
+ this.openDropdownPath = null;
200
+ },
201
+
202
// --- Navigation ----------------------------------------------------------
203
async fetchFiles(path = "") {
204
this.isLoading = true;
webui/components/modals/file-browser/file-browser.html
+6
-11
@@ -61,19 +61,14 @@
61
<!-- Single-item actions (Edit/Rename/...) are grouped under a dropdown -->
62
<div
63
class="dropdown file-actions-dropdown"
64
- x-data="{
65
- open: false,
66
- toggle() { this.open = !this.open; },
67
- close() { this.open = false; }
68
- }"
69
- @click.outside="close()"
70
- @keydown.escape.window="close()"
64
+ @click.outside="$store.fileBrowser.closeDropdown()"
65
+ @keydown.escape.window="$store.fileBrowser.closeDropdown()"
66
>
67
<button
68
type="button"
69
class="btn-icon-action dropdown-trigger"
75
- @click.stop="toggle()"
76
- :aria-expanded="open.toString()"
70
+ @click.stop="$store.fileBrowser.toggleDropdown(file.path)"
71
+ :aria-expanded="$store.fileBrowser.isDropdownOpen(file.path).toString()"
72
aria-label="More actions"
73
title="More actions"
74
>
@@ -82,11 +77,11 @@
77
78
<div
79
class="dropdown-menu"
85
- x-show="open"
80
+ x-show="$store.fileBrowser.isDropdownOpen(file.path)"
81
x-transition
82
:class="{ 'bottom': $el.getBoundingClientRect().bottom > window.innerHeight - 100 }"
83
style="display: none;"
89
- @click="close()"
84
+ @click="$store.fileBrowser.closeDropdown()"
85
>
86
<button
87
type="button"