fix: toggleExpand DOM traversal robuste pour sous-dossiers renderChildren
FlowDeck CI / test (push) Failing after 4s
FlowDeck CI / docker (push) Has been skipped

Remplacé li.querySelector(':scope > ul.ws-tree') par une boucle sur
itemDiv.parentElement.children. Évite les problèmes de compatibilité
de :scope et trouve le <ul> frère du .ws-tree-item de manière fiable.

Chemin: btn → .ws-tree-item → parentElement (<li>) → itère children
→ premier UL.ws-tree → toggle display.
This commit is contained in:
2026-07-11 10:20:42 -04:00
parent 47299113a8
commit 5e3bcdcd63
+10 -6
View File
@@ -392,14 +392,18 @@ document.addEventListener('alpine:init', function() {
toggleExpand(id, btn) {
this.expanded[id] = !(this.expanded[id] || false);
this.expanded = Object.assign({}, this.expanded);
// For renderChildren static HTML: toggle the sibling <ul> + chevron rotation
// For renderChildren static HTML: toggle chevron + sibling <ul>
if (btn) {
btn.classList.toggle('open', this.expanded[id]);
var li = btn.closest('li');
if (li) {
var ul = li.querySelector(':scope > ul.ws-tree');
if (ul) {
ul.style.display = this.expanded[id] ? '' : 'none';
// Navigate: btn → .ws-tree-item → <li> → <ul.ws-tree>
var itemDiv = btn.closest('.ws-tree-item');
if (itemDiv && itemDiv.parentElement) {
var children = itemDiv.parentElement.children;
for (var i = 0; i < children.length; i++) {
if (children[i].tagName === 'UL' && children[i].classList.contains('ws-tree')) {
children[i].style.display = this.expanded[id] ? '' : 'none';
break;
}
}
}
}