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

selectkey and autoHighlight bug #29

Open
seif3r opened this issue Nov 16, 2015 · 0 comments
Open

selectkey and autoHighlight bug #29

seif3r opened this issue Nov 16, 2015 · 0 comments

Comments

@seif3r
Copy link

seif3r commented Nov 16, 2015

Using autocomplete with

  • selectKeys : [13],
  • autoHighlight: false

gives me the bug that I cannot use Enter to select the raw unhighlighted input.

// A select key has been pressed
    else if ($.inArray(event.keyCode, options.selectKeys) >= 0 &&
             !event.shiftKey && !event.ctrlKey && !event.altKey &&
             !event.metaKey) {
      select();
     return event.keyCode == 9; // Never cancel tab
    }

If I change the return keyCode to 13 or just comment the return line away it works the way I expect it too.

/** edit **/
After working on it a bit this is the solution i came up with, can probably be done alot better, but it seems to work.

      // A select key has been pressed
      else if ($.inArray(event.keyCode, options.selectKeys) >= 0 &&
              !event.shiftKey && !event.ctrlKey && !event.altKey &&
              !event.metaKey) {
        // With autoHighlight off and only Enter key as selectvalue this gives us a bug
        // This if -> else fixes it.
        if (index == -1 && (event.keyCode).inArray(options.selectKeys)) {
          select();
        }
        else {
          select();
          return event.keyCode == 9; // Never cancel tab
        }
      }
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

No branches or pull requests

1 participant