Skip to content

Commit

Permalink
🐛 クエリの表示バグを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
kinoko2k committed Jun 11, 2024
1 parent c80b40f commit 90f54a4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ function handleKeyPress(event) {

// URLのqueryを更新
const newUrl = new URL(window.location);
newUrl.searchParams.set('search_query', searchTerm);
if (searchTerm) {
newUrl.searchParams.set('search_query', searchTerm);
} else {
newUrl.searchParams.delete('search_query');
}
history.pushState(null, '', newUrl);

scrollToItem(searchTerm, contentItems);
Expand Down

0 comments on commit 90f54a4

Please sign in to comment.