fix(search): only log search AFTER unfocusing
This commit is contained in:
parent
15fc0cf725
commit
b62889a84f
1 changed files with 8 additions and 3 deletions
11
js/app.js
11
js/app.js
|
|
@ -1276,7 +1276,6 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
const performSearch = debounce((query) => {
|
const performSearch = debounce((query) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
ui.addToSearchHistory(query);
|
|
||||||
navigate(`/search/${encodeURIComponent(query)}`);
|
navigate(`/search/${encodeURIComponent(query)}`);
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
@ -1288,6 +1287,13 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
searchInput.addEventListener('change', (e) => {
|
||||||
|
const query = e.target.value.trim();
|
||||||
|
if (query.length > 2) {
|
||||||
|
ui.addToSearchHistory(query);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
searchInput.addEventListener('focus', () => {
|
searchInput.addEventListener('focus', () => {
|
||||||
ui.renderSearchHistory();
|
ui.renderSearchHistory();
|
||||||
});
|
});
|
||||||
|
|
@ -1932,6 +1938,5 @@ function showKeyboardShortcuts() {
|
||||||
};
|
};
|
||||||
|
|
||||||
modal.addEventListener('click', handleClose);
|
modal.addEventListener('click', handleClose);
|
||||||
|
|
||||||
modal.classList.add('active');
|
modal.classList.add('active');
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue