From ca95fc46aa5b1a1437ced69071bf1a6aaa54d520 Mon Sep 17 00:00:00 2001 From: Kpa-clawbot Date: Fri, 3 Apr 2026 00:49:17 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20neighbor=20UI=20=E2=80=94=20show=20neigh?= =?UTF-8?q?bors=20crash,=20dark=20mode=20contrast=20(#523)=20(#527)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Part of #523 — fixes bugs 5 and 7 (bug 6 was a duplicate of bug 7). ### Bug 5: Show Neighbors button throws `window._mapSelectRefNode is not a function` **Root cause:** Map popup HTML used inline `onclick` calling `window._mapSelectRefNode`, which was deleted on SPA page destroy. If a popup persisted after navigation, clicks would throw. **Fix:** Replaced inline `onclick` with event delegation. A document-level click handler catches all `[data-show-neighbors]` clicks and calls `selectReferenceNode` directly. The global `window._mapSelectRefNode` is still exposed for existing Playwright tests but is no longer relied upon by the UI. ### Bug 7: Blue text on dark blue background (dark mode contrast) **Root cause:** Neighbor table cells inside `.node-detail-section` / `.node-full-card` inherited accent/link color instead of using `var(--text)`, making text unreadable in dark mode. **Fix:** Added explicit `color: var(--text)` on `.node-detail-section .data-table td` and `.node-full-card .data-table td`. Only `` tags within those cells retain `color: var(--accent)`. ### Files changed - `public/map.js` — event delegation for Show Neighbors - `public/style.css` — contrast fix for neighbor table cells --------- Co-authored-by: you --- public/map.js | 12 ++++++++++-- public/style.css | 9 +++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/public/map.js b/public/map.js index b86c63c4..e70a8faf 100644 --- a/public/map.js +++ b/public/map.js @@ -807,7 +807,15 @@ if (cb) cb.checked = true; renderMarkers(); } - // Expose for popup onclick and testing + // Event delegation for Show Neighbors links (avoids inline onclick / global function timing issues) + document.addEventListener('click', function(e) { + var link = e.target.closest('[data-show-neighbors]'); + if (link) { + e.preventDefault(); + selectReferenceNode(link.dataset.pubkey, link.dataset.name); + } + }); + // Expose for testing window._mapSelectRefNode = selectReferenceNode; window._mapGetNeighborPubkeys = function() { return neighborPubkeys ? Array.from(neighborPubkeys) : []; }; @@ -838,7 +846,7 @@
View Node → - ${node.public_key ? ` · Show Neighbors` : ''} + ${node.public_key ? ` · Show Neighbors` : ''}
`; } diff --git a/public/style.css b/public/style.css index 6c211794..d8349588 100644 --- a/public/style.css +++ b/public/style.css @@ -630,6 +630,15 @@ button.ch-item.selected { background: var(--selected-bg); } background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; } +/* Bug 7 fix: neighbor table text inherits accent color — force readable text */ +.node-detail-section .data-table td, +.node-full-card .data-table td { + color: var(--text); +} +.node-detail-section .data-table td a, +.node-full-card .data-table td a { + color: var(--accent); +} .node-detail-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 8px; padding-bottom: 4px;