From ff7cfb45df9f7228b8cda0f22645ae891fc93a43 Mon Sep 17 00:00:00 2001 From: cmliu Date: Fri, 31 Jul 2026 04:32:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AB=8B=E5=8D=B3=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=9B=AE=E5=BD=95=E4=BB=A5=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E5=AD=90=E8=8A=82=E7=82=B9=E6=B8=B2=E6=9F=93=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=97=A0=E9=9A=9C=E7=A2=8D=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/file-tree.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/file-tree.ts b/frontend/src/file-tree.ts index 5b8fb8f..d1da854 100644 --- a/frontend/src/file-tree.ts +++ b/frontend/src/file-tree.ts @@ -677,6 +677,16 @@ export class FileTree { if (token !== this.setCwdToken) return; } + // Expand the target directory itself (not just its ancestors) so its + // children are immediately rendered and aria-expanded is "true". + // This covers initial-connection setCwd where activateNode is never + // called — ancestors were expanded during the loop above; the target + // needs this extra step. + if (current.state === 'collapsed' && current.type === 'directory' && !current.unavailable) { + await this.expandNode(current, true); + if (token !== this.setCwdToken) return; + } + this.highlightNode(current); this.focusedNode = current; this.updateTabindex();