Skip to content

Commit

Permalink
Close search dialog after selecting item
Browse files Browse the repository at this point in the history
Resolves #118
  • Loading branch information
oodamien committed Jul 26, 2023
1 parent 94e58dc commit a4310e9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/js/vendor/search.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@
</li>`
})
.join('')

container.querySelectorAll('ul a').forEach((a) => {
a.addEventListener('click', () => {
MicroModal.close('modal-1')
})
})

if (!lastRenderArgs.isLastPage) {
const more = document.createElement('div')
const link = document.createElement('a')
Expand Down Expand Up @@ -149,6 +156,7 @@
const hits = document.querySelectorAll('#hits>ul>li>a')
if (hits[index]) {
hits[index].click()
MicroModal.close('modal-1')
}
}

Expand Down

0 comments on commit a4310e9

Please sign in to comment.