Docs: clicking anywhere in an article's box opens it

Before, only the title text was clickable. The copy-link button keeps its
own action, and ctrl/cmd/shift-click on the box opens a new tab.
This commit is contained in:
Johan Sandoval committed 2026-10-07 18:50:18 +00:00
1 parent 486b57cacb
commit 5e8dea8027
2 files changed
+9 -1

No files matched your search

+8
View File
@@ -137,6 +137,14 @@
document.addEventListener('click', e => {
const a = e.target.closest('#docList a[data-doc]');
if (a && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.button === 0) { e.preventDefault(); openDoc(a.dataset.doc); return; }
// Anywhere else in the highlighted box (except the copy-link button) opens it too
const item = !a && !e.target.closest('.kb-copy') && e.target.closest('#docList .kb-item');
const itemLink = item && item.querySelector('a[data-doc]');
if (itemLink && e.button === 0) {
if (e.ctrlKey || e.metaKey || e.shiftKey) window.open(itemLink.href, '_blank', 'noopener');
else openDoc(itemLink.dataset.doc);
return;
}
// Links between articles (/docs/Title or the older ?doc=Title) open in place
const link = e.target.closest('#docContent a[href]');
if (link && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.button === 0 && link.target !== '_blank') {