diff --git a/templates/index.html b/templates/index.html index ccec983..5007c25 100644 --- a/templates/index.html +++ b/templates/index.html @@ -150,11 +150,13 @@ if (parentPath === '') parentPath = '/'; const tr = document.createElement('tr'); + tr.className = 'file-row'; + tr.onclick = () => enterDir(parentPath); tr.innerHTML = ` + .. - `; tbody.appendChild(tr); @@ -193,18 +195,14 @@ // Row click should not trigger when clicking on interactive elements tr.addEventListener('click', (e) => { - if (e.target.matches('input, button, a, i')) return; // Ignore clicks on actions/checkboxes + // Ignore clicks on actions, checkboxes, or links + if (e.target.closest('button, a, input')) return; + if (file.is_dir) { enterDir(file.path); } }); - // Make the text part of the cell clickable for directory navigation - const fileNameCell = tr.querySelector('.file-name-cell'); - if(file.is_dir) { - fileNameCell.classList.add('file-row'); - fileNameCell.onclick = () => enterDir(file.path); - } tbody.appendChild(tr); }); }