Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes TAB and RETURN keys behaviour #676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fixes TAB and RETURN keys behaviour #676

wants to merge 1 commit into from

Conversation

alpha-and-omega
Copy link

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:

  • It is impossible to enter short values to the input field USING Tab and Enter keys IF there are longer results in suggestions area AND if mouse pointer is over those results (accidentely it is always there).

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:

  • Open demo jQuery-Autocomplete/index.htm from the source (can't find it online)
  • Click to the second example (first uses Hint and should work as it is) under "Type NHL or NBA team name:" input field
  • move mouse pointer down a bit, to the "Container" word
  • Try to enter letter "a" and push Tab, this will result to 'Atlanta Thrashers'' selection.
  • As you can see, without moving mouse pointer outside of suggestion area it is impossible to enter "a" symbol to this field
  • Go to google.com and try the same with their suggestion field - google behaves corectly

Patch

Patch provided.

@LorenMaxwell
Copy link

Excellent fix. Much needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants