Skip to content

Commit 5e2b9ae

Browse files
committed
WebUI: Improve folder collapse behavior
When the left arrow key is triggered while on a file or collapsed folder, we now select the parent folder.
1 parent 9dcad7f commit 5e2b9ae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/webui/www/private/scripts/dynamicTable.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,11 +2460,22 @@ window.qBittorrent.DynamicTable ??= (() => {
24602460
return;
24612461

24622462
const node = this.getNode(id);
2463-
if (node.isFolder) {
2463+
if (node.isFolder && !this.isCollapsed(node.rowId)) {
24642464
this.collapseNode(node.rowId);
24652465
if (this.useVirtualList)
24662466
this.rerender();
2467+
return;
24672468
}
2469+
2470+
// when node is already collapsed or is a file, select parent
2471+
const parent = node.root;
2472+
if ((parent === null) || (parent.rowId === null))
2473+
return;
2474+
2475+
const parentRowId = parent.rowId.toString();
2476+
this.deselectAll();
2477+
this.selectRow(parentRowId);
2478+
this.getTrByRowId(parentRowId)?.focus({ preventScroll: true });
24682479
}
24692480

24702481
isAllCheckboxesChecked() {

0 commit comments

Comments
 (0)