devbridge / jQuery-Autocomplete

Ajax Autocomplete for jQuery allows you to easily create autocomplete/autosuggest boxes for text input fields
https://www.devbridge.com/sourcery/components/jquery-autocomplete/
Other
3.56k stars 1.66k forks source link

fixes TAB and RETURN keys behaviour #675

Closed alpha-and-omega closed 6 years ago

alpha-and-omega commented 6 years ago

Hi! This patch chages bahaviour when using Tab and Enter to be more consistent with plugin role.

Why: Warning: it is not easy to understand what is wrong, so be ready for some brain work :)

After using this plugin for some time on production website I realised that there is something wrong with it. Fixing it without changing source code went impossible.

Whats wrong:

This is because active suggestion is changed by mouseover event.

How it should work:

It should be possible to enter any value and finish entering it with Tab or Enter without modification and without generating select action on plugin, wherever mouse pointer is. More strictly - suggestion selection using Tab and Enter should fire only when suggestion was chosen by UP and Down keys, not by mouse.

How to reproduce:

Patch

Patch provided.