From 5e8dea802702c604cea9ace02a3adbd20b78e666 Mon Sep 17 00:00:00 2001 From: Johan Sandoval Date: Wed, 7 Oct 2026 18:50:18 +0000 Subject: [PATCH] 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. --- web/docs.css | 2 +- web/docs.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/docs.css b/web/docs.css index e2d2435..355728a 100644 --- a/web/docs.css +++ b/web/docs.css @@ -10,7 +10,7 @@ /* 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 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.active { background: rgba(52,152,219,0.14); border-color: #3498db; } .kb-item-main { min-width: 0; flex: 1; } diff --git a/web/docs.js b/web/docs.js index 7a0289f..08b44d6 100644 --- a/web/docs.js +++ b/web/docs.js @@ -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') {