From b6739fff707aa6dbfb8addff18906345facecc83 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Mon, 2 Feb 2026 08:13:05 -0500 Subject: [PATCH] Fix thread search suggestions: navigate on click, fix duplicate ID - Add explicit click handler on suggestions so clicking navigates to the existing thread instead of interacting with the form - Fix duplicate id="thread_title_input" in forms.j2 edit macro (renamed to edit_title_input to avoid conflict with create form) --- remarkbox/static/js/custom.js | 10 ++++++++++ remarkbox/templates/snippets/forms.j2 | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/remarkbox/static/js/custom.js b/remarkbox/static/js/custom.js index d169039..4513446 100644 --- a/remarkbox/static/js/custom.js +++ b/remarkbox/static/js/custom.js @@ -147,6 +147,16 @@ function initThreadTitleTypeahead() { }, 400); }); + // Clicking a suggestion navigates to that thread. + suggestionsDiv.addEventListener('click', function(e) { + var link = e.target.closest('.suggestion-item'); + if (link && link.href) { + e.preventDefault(); + e.stopPropagation(); + window.location.href = link.href; + } + }); + // Hide suggestions when clicking outside. document.addEventListener('click', function(e) { if (e.target !== titleInput && !suggestionsDiv.contains(e.target)) { diff --git a/remarkbox/templates/snippets/forms.j2 b/remarkbox/templates/snippets/forms.j2 index 23d4d5f..4f05bd9 100644 --- a/remarkbox/templates/snippets/forms.j2 +++ b/remarkbox/templates/snippets/forms.j2 @@ -49,7 +49,7 @@ {% if node.title %}