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)
This commit is contained in:
parent
c038b649b2
commit
b6739fff70
2 changed files with 11 additions and 1 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
{% if node.title %}
|
||||
<input
|
||||
name = "thread_title"
|
||||
id = "thread_title_input"
|
||||
id = "edit_title_input"
|
||||
class = "common-text-input"
|
||||
value = "{{ node.title }}"
|
||||
placeholder = "Descriptive title"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue