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

+1 -1
View File
@@ -10,7 +10,7 @@
/* groups + items */ /* groups + items */
.kb-group-title { font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 2px 0 6px; display: flex; justify-content: space-between; } .kb-group-title { font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 2px 0 6px; display: flex; justify-content: space-between; }
.kb-group-title span { font-weight: 600; } .kb-group-title span { font-weight: 600; }
.kb-item { display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; margin: 0 0 2px; min-width: 0; border-radius: 6px; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; } .kb-item { cursor: pointer; display: flex; align-items: flex-start; gap: 6px; padding: 6px 8px; margin: 0 0 2px; min-width: 0; border-radius: 6px; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.kb-item:hover { background: rgba(52,152,219,0.08); border-color: rgba(52,152,219,0.45); box-shadow: 0 0 6px rgba(52,152,219,0.35); } .kb-item:hover { background: rgba(52,152,219,0.08); border-color: rgba(52,152,219,0.45); box-shadow: 0 0 6px rgba(52,152,219,0.35); }
.kb-item.active { background: rgba(52,152,219,0.14); border-color: #3498db; } .kb-item.active { background: rgba(52,152,219,0.14); border-color: #3498db; }
.kb-item-main { min-width: 0; flex: 1; } .kb-item-main { min-width: 0; flex: 1; }
+8
View File
@@ -137,6 +137,14 @@
document.addEventListener('click', e => { document.addEventListener('click', e => {
const a = e.target.closest('#docList a[data-doc]'); 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; } 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 // Links between articles (/docs/Title or the older ?doc=Title) open in place
const link = e.target.closest('#docContent a[href]'); const link = e.target.closest('#docContent a[href]');
if (link && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.button === 0 && link.target !== '_blank') { if (link && !e.ctrlKey && !e.metaKey && !e.shiftKey && e.button === 0 && link.target !== '_blank') {