@@ -41,13 +41,13 @@ export function init(id, invoke, value, changedEventCallback) {
4141 const duration = parseInt ( input . getAttribute ( 'data-bb-debounce' ) || '0' ) ;
4242 if ( duration > 0 ) {
4343 ac . debounce = true
44- EventHandler . on ( input , 'keyup ' , debounce ( e => {
45- handlerKeyup ( ac , e ) ;
44+ EventHandler . on ( input , 'keydown ' , debounce ( e => {
45+ handlerKeydown ( ac , e ) ;
4646 } , duration ) )
4747 }
4848 else {
49- EventHandler . on ( input , 'keyup ' , e => {
50- handlerKeyup ( ac , e ) ;
49+ EventHandler . on ( input , 'keydown ' , e => {
50+ handlerKeydown ( ac , e ) ;
5151 } )
5252 }
5353
@@ -86,7 +86,6 @@ export function init(id, invoke, value, changedEventCallback) {
8686
8787 el . classList . add ( 'is-loading' ) ;
8888 filterCallback ( v ) ;
89-
9089 } ) ;
9190
9291 ac . show = ( ) => {
@@ -116,7 +115,7 @@ export function init(id, invoke, value, changedEventCallback) {
116115 } ) ;
117116 }
118117
119- ac . keyup = e => {
118+ ac . keydown = e => {
120119 if ( e . key === 'Tab' ) {
121120 [ ...document . querySelectorAll ( '.auto-complete.show' ) ] . forEach ( a => {
122121 const id = a . getAttribute ( 'id' ) ;
@@ -139,7 +138,7 @@ export function init(id, invoke, value, changedEventCallback) {
139138
140139 registerBootstrapBlazorModule ( 'AutoComplete' , id , ( ) => {
141140 EventHandler . on ( document , 'click' , ac . closePopover ) ;
142- EventHandler . on ( document , 'keyup ' , ac . keyup ) ;
141+ EventHandler . on ( document , 'keydown ' , ac . keydown ) ;
143142 } ) ;
144143
145144 EventHandler . on ( el , 'click' , '.clear-icon' , e => {
@@ -148,7 +147,7 @@ export function init(id, invoke, value, changedEventCallback) {
148147 } ) ;
149148}
150149
151- const handlerKeyup = ( ac , e ) => {
150+ const handlerKeydown = ( ac , e ) => {
152151 const key = e . key ;
153152 const { el, invoke, menu } = ac ;
154153 if ( key === 'Enter' || key === 'NumpadEnter' ) {
@@ -209,7 +208,7 @@ export function dispose(id) {
209208 }
210209 }
211210 EventHandler . off ( menu , 'click' ) ;
212- EventHandler . off ( input , 'keyup ' ) ;
211+ EventHandler . off ( input , 'keydown ' ) ;
213212 Input . dispose ( input ) ;
214213
215214 EventHandler . off ( el , 'click' ) ;
@@ -218,7 +217,7 @@ export function dispose(id) {
218217 const { AutoComplete } = window . BootstrapBlazor ;
219218 AutoComplete . dispose ( id , ( ) => {
220219 EventHandler . off ( document , 'click' , ac . closePopover ) ;
221- EventHandler . off ( document , 'keyup ' , ac . keyup ) ;
220+ EventHandler . off ( document , 'keydown ' , ac . keydown ) ;
222221 } ) ;
223222}
224223
0 commit comments