File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments