corejavascript / corejavascript/typeahead.js

No hook (i.e. none of selected, autocomplete or cursorchange fired) if user types in exact match

Open
#33 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
968
Forks
231
PR merge metrics
No merged PRs in 30d

Description

I have bloodhound configured to fetch Json data, which it does very nicely.

   // constructs the suggestion engine

var bloodHound = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: 'http://localhost:9000/invoices%QUERY',
wildcard: '%QUERY'
}
});

In addition, the three main custom events are bound to the function "handler".

    ta.bind("typeahead:cursorchange", handler);

ta.bind("typeahead:autocomplete", handler);
ta.bind("typeahead:select", handler);

So almost everything works: if the user types in a string that matches part of a result and completes using tab, the autocomplete event fires and the correct item is selected. If the user uses the arrow keys or the mouse to select from the dropdown, that works. Even if the user types in the whole string matching a result but in the wrong case, and then presses tab, it works. BUT if the user types in a string that precisely matches the result, no event is fired and there is no direct way that I can find to get the data from the matching Json result into the form. I think this is a bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.