fix: 立即展开目标目录以确保子节点渲染并优化无障碍体验

This commit is contained in:
cmliu committed 2026-07-31 04:32:45 +08:00
1 parent 5689ed4239
commit ff7cfb45df
1 file changed
+10
+10
View File
@@ -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();