@@ -40,15 +40,15 @@ export function init(id, invoke) {
4040 const duration = parseInt ( input . getAttribute ( 'data-bb-debounce' ) || '0' ) ;
4141 if ( duration > 0 ) {
4242 ac . debounce = true
43- EventHandler . on ( input , 'keyup ' , debounce ( e => {
44- handlerKeyup ( ac , e ) ;
43+ EventHandler . on ( input , 'keydown ' , debounce ( e => {
44+ handlerKeydown ( ac , e ) ;
4545 } , duration , e => {
4646 return [ 'ArrowUp' , 'ArrowDown' , 'Escape' , 'Enter' , 'NumpadEnter' ] . indexOf ( e . key ) > - 1
4747 } ) )
4848 }
4949 else {
50- EventHandler . on ( input , 'keyup ' , e => {
51- handlerKeyup ( ac , e ) ;
50+ EventHandler . on ( input , 'keydown ' , e => {
51+ handlerKeydown ( ac , e ) ;
5252 } )
5353 }
5454
@@ -117,7 +117,7 @@ export function init(id, invoke) {
117117 } ) ;
118118}
119119
120- const handlerKeyup = ( ac , e ) => {
120+ const handlerKeydown = ( ac , e ) => {
121121 const key = e . key ;
122122 const { el, input, invoke, menu } = ac ;
123123 if ( key === 'Enter' || key === 'NumpadEnter' ) {
@@ -162,6 +162,9 @@ const handlerKeyup = (ac, e) => {
162162 invoke . invokeMethodAsync ( 'TriggerDeleteCallback' , input . value ) ;
163163 }
164164 }
165+ if ( e . key === 'Tab' ) {
166+ ac . triggerBlur ( ) ;
167+ }
165168}
166169
167170export function showList ( id ) {
@@ -189,7 +192,7 @@ export function dispose(id) {
189192 }
190193 }
191194 EventHandler . off ( input , 'change' ) ;
192- EventHandler . off ( input , 'keyup ' ) ;
195+ EventHandler . off ( input , 'keydown ' ) ;
193196 EventHandler . off ( menu , 'click' ) ;
194197 Input . dispose ( input ) ;
195198
0 commit comments