File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,6 @@ function focus_next_result() {
105105    results [ current_focus  +  1 ] . focus ( ) ; 
106106} 
107107
108- function  enter_focus ( )  { 
109-   if  ( n_focus  ===  null )  return ; 
110-   let  elt  =  current_result ( ) ; 
111-   elt . click ( ) ; 
112- } 
113108
114109function  is_searching ( )  { 
115110  return  ( document . querySelectorAll ( ".odoc-search:focus-within" ) . length  >  0 ) ; 
@@ -140,12 +135,13 @@ function handle_key_down(event) {
140135      event . preventDefault ( ) ; 
141136      enter_search ( ) ; 
142137    } 
143-     else  if  (  event . key . length  ===  1 
144-             &&  ( ascii  >=  65  &&  ascii  <=  90 )  // lowercase letter 
145-             ||  ( ascii  >=  97  &&  ascii  <=  122 )  // uppercase letter 
146-             ||  ( ascii  >=  48  &&  ascii  <=  57 )  // numbers 
147-             ||  ( ascii  >=  32  &&  ascii  <=  46 )  // ` ` to `.` 
148-             ||  ( ascii  >=  58  &&  ascii  <=  64 )  // `:` to `@` 
138+     else  if  (   is_searching ( ) 
139+             &&  event . key . length  ===  1 
140+             &&  (   ( ascii  >=  65  &&  ascii  <=  90 )  // lowercase letter 
141+                ||  ( ascii  >=  97  &&  ascii  <=  122 )  // uppercase letter 
142+                ||  ( ascii  >=  48  &&  ascii  <=  57 )  // numbers 
143+                ||  ( ascii  >=  32  &&  ascii  <=  46 )  // ` ` to `.` 
144+                ||  ( ascii  >=  58  &&  ascii  <=  64 ) )  // `:` to `@` 
149145            ) 
150146      // We do not prevent default because we want the char to be added to the input 
151147      enter_search  ( ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments