Skip to content

Commit 744efb6

Browse files
author
Janaka-Steph
committed
Fix search
1 parent 378d7a0 commit 744efb6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ui/src/js/vendor/search-lunr.bundle.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ window.antoraLunr = (function (lunr) {
121121
searchResultItem.classList.add('search-result-item')
122122
searchResultItem.appendChild(documentTitle)
123123
searchResultItem.appendChild(documentHit)
124+
125+
/***
126+
* mousedown event is triggered before blur event
127+
* We leverage that to prevent blur attached to searchInput if mousedown on searchResultItem
128+
* So the search click works
129+
*/
130+
searchResultItem.addEventListener('mousedown', function (e) {
131+
e.preventDefault()
132+
})
124133
return searchResultItem
125134
}
126135

@@ -194,6 +203,8 @@ window.antoraLunr = (function (lunr) {
194203
}, 100)
195204
// TODO listen to blur, focus and input events
196205
searchInput.addEventListener('keydown', search)
206+
207+
// this is prevented in case of mousedown attached to SearchResultItem
197208
searchInput.addEventListener('blur', function (e) {
198209
e.target.value = ''
199210
while (searchResult.firstChild) {

0 commit comments

Comments
 (0)