Typeahead workaround for having to press enter twice

Currently, one has to press enter twice in order to submit the package
search form with typeahead completion. Add a workaround to fix this.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Joris Steyn 2014-01-11 12:03:01 +01:00 committed by Lukas Fleischer
parent 0d68494de7
commit 72e4d54178

View file

@ -124,6 +124,15 @@ $(document).ready(function() {
return item;
}
}).attr('autocomplete', 'off');
$('#pkgsearch-field').keydown(function(e) {
if (e.keyCode == 13) {
var selectedItem = $('ul.pkgsearch-typeahead li.active');
if (selectedItem.length == 0) {
$('#pkgsearch-form').submit();
}
}
});
});
</script>
<?php