({ focus = true } = {})
| 485 | |
| 486 | function initSearch() { |
| 487 | function clearSearch({ focus = true } = {}) { |
| 488 | if (!searchInput) return; |
| 489 | searchInput.value = ''; |
| 490 | renderSection(currentSectionId, { updateUrl: true, clearSearch: false, scroll: false }); |
| 491 | clearSearchBtn?.classList.remove('visible'); |
| 492 | setResultStatus('', false); |
| 493 | if (focus) searchInput.focus(); |
| 494 | } |
| 495 | |
| 496 | searchInput?.addEventListener('input', (event) => { |
| 497 | renderSearch(event.target.value || '', { updateUrl: true }); |
no test coverage detected