File tree 2 files changed +9
-14
lines changed
2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change 14
14
render ( $ ( event . target ) ) ;
15
15
16
16
// Hide keyboard on mobile browser
17
- $searchInput . blur ( ) ;
17
+ // $searchInput.blur();
18
18
} ) ;
19
19
20
20
// Prevent reloading page by enter key on sidebar search.
62
62
// Dispose existing popover
63
63
//
64
64
65
- {
66
- let popover = bootstrap . Popover . getInstance ( $targetSearchInput [ 0 ] ) ;
67
- if ( popover !== null ) {
68
- popover . dispose ( ) ;
69
- }
70
- }
65
+ bootstrap . Popover . getInstance ( $targetSearchInput [ 0 ] ) ?. dispose ( ) ;
71
66
72
67
//
73
68
// Search
74
69
//
75
-
76
- if ( idx === null ) {
77
- return ;
78
- }
79
-
80
70
const searchQuery = $targetSearchInput . val ( ) ;
81
- if ( searchQuery === '' ) {
71
+ if ( idx === null || searchQuery === "" ) {
82
72
return ;
83
73
}
84
74
182
172
183
173
//Bring focus to search bar
184
174
$ ( document ) . on ( 'keydown' , function ( event ) {
185
- if ( event . key === '/' ) {
175
+ if ( event . key === '/' ) {
186
176
$searchInput . focus ( ) ;
187
177
}
188
178
} ) ;
Original file line number Diff line number Diff line change 13
13
href ="
https://unpkg.com/[email protected] /dist/css/main.min.css "
14
14
/>
15
15
< script >
16
+ function focusSearchBar ( ) {
17
+ var searchBar = document . querySelector ( ".td-search__input" ) ;
18
+ searchBar . focus ( ) ;
19
+ }
20
+
16
21
searchKey . addEventListener ( "click" , ( ) => {
17
22
event . preventDefault ( ) ;
18
23
focusSearchBar ( ) ;
You can’t perform that action at this time.
0 commit comments