I've got some autocompletes working finally, but there is one behavior I'd like to change. If the user types in a partial value and clicks anywhere outside of the list returned, the partial value gets set in the input. I would prefer that the value remain blank if the user doesn't select one of the returned options.
It looks like the focus event is what I should be modifying, but I find the API confusing... it says:
Before focus is moved to an item (not selecting), ui.item refers to the focused
item. The default action of focus is to replace the text field's value with the
value of the focused item, though only if the focus event was triggered by a
keyboard interaction. Canceling this event prevents the value from being updated,
but does not prevent the menu item from being focused.
but it doesn't give an example of how to cancel the event.