[Search and Autocomplete] Notified value on quickly input change

Forge Component
Published on 2019-03-24 by Leonardo Fernandes
24 votes
Published on 2019-03-24 by Leonardo Fernandes

First of all, to say that I loved how the autocomplete is implemented, is a great component, so thank you very much for the contribution!

I have a few questions, but if it seems good I'll put them one at a time, so as not to mix themes and other users can find them easier.

One of the behaviors that it is strange (I do not know it's normal or maybe issue) is that, if a user edits the search's input quickly and loses focus (with tab key, for example, before the autocomplete list appears) the value reported to the search webblock is the last time the autocomplete appeared.

Example steps:

1- I go to serachelp page, here: LINK.

2- Type in "person" autocomplete "a". Show this

3- If, after that, I type "r", and wait 800 ms, appears the result refreshed.

and after that, press tab button, "Art Venere" is selected. All OK

4- But, if insted wait 800 ms I press tab button quickly, I would expect the search engine to launch the search also with "ar", and therefore, also select "Art Venere" (because has "select first"), but change the text to "a" value again (previous value), and notify to SearchWeblock with "a" value, so the result selected is not the expected

This case occurs, for example, when there are people very used to working with the application (and search, for example, employees by code), and if they write fast and lost the focus they are not getting the expected data.

Could you help me with that?

Thanks for help,

Hi Carlos

The behaviour is as designed/intended.

Perhaps an option to reduce the wait time on the list refresh will satisfy your requirement?


Hi Hanno, thanks for the idea

As Leonardo explain in this thread, we could set the time of delay between type and throw search, as you suggest, and could works as workarround, but would have a negative impact in performance, because each character you type would throw a search...

The expected behavior (at least I think so) is that if you lose the focus and you have changed the input value throw the search with current value, not with the previos one... may setting the value in onBlur before throw the onchange o whatever... 

I hope Leonardo could shed light about the matter ;-)


Hi Carlos.

When you press TAB, it selects the item that is highlighted, and that's it. As Hanno said, that's how the autocomplete is expected to behave.

The alternative you propose would require waiting for the ajax refresh to update the list of results, before registering the result of the TAB. In that case, it wouldn't be possible to have immediate feedback when you press TAB.

You might try this other component: https://www.outsystems.com/forge/component-overview/532/fastautocomplete which handles the autocomplete in the client side. I think it will solve your problem with fast typers.

I agree with Leonardo and support his recommendation.  I also had performance issues with the Search and Autocomplete component and modified it to cache to local storage (this was before the Fast Autocomplete component was made available).  

I personally have not used Fast Autocomplete, but I can say that caching your lookup tables to local storage is the best approach to increase performance for this use case.

I was thinking in some alternative solution, such preventing the loss of focus if you have typed and search has not been throwed (for example)... but maybe it's too complicated. As you said, I could explain the user understands that the selected data is the hightlighted one, and if they type quickly and do not wait for the list to appear they do not mark anything ... 

Also, I have test "fast autocomplete" as you suggested, and it's a great option (less flexible) and it goes faster because it has cached the results in the local storage, but... it could has some problems, like big clien-side list, outdated data, les flexible, etc... And, in fact, works like Leonardo autocomplete, the selected value is the hightlighted result, so, if you type fast and press tab (, and list has not reloaded, also select the hightlighted in the previous list.

So, I think I'm going to use Search and Autocomplete.

Thanks to all for answers