Using jQuery 2.1.0 and jQuery.ui 1.11.0 Tested in iOS 7. iPhone and iPad Mini. Works on android and regular browsers.
We recently upgraded from
Wrote a super nasty hack which seems to do the trick for me. Here's what I did.
(optional) Try once more... in case the set time wasn't long enough for the element to gain the ui-state-focus class.
$('.autocompleteContainer').on('touchstart', 'li.ui-menu-item', function(){
var $container = $(this).closest('.autocompleteContainer'),
$item = $(this);
//if we haven't closed the result box like we should have, simulate a click on the element they tapped on.
function fixitifitneedsit() {
if ($container.is(':visible') && $item.hasClass('ui-state-focus')) {
$item.trigger('click');
return true; // it needed it
}
return false; // it didn't
}
setTimeout(function () {
if (!fixitifitneedsit()) {
setTimeout(fixitifitneedsit, 600);
}
}, 600);
});
Hopefully someone has a nicer solution though!