[aur-dev] [PATCH] Typeahead workaround for having to press enter twice

Lukas Fleischer archlinux at cryptocrack.de
Sat Jan 11 06:07:32 EST 2014


From: Joris Steyn <jorissteyn at gmail.com>

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 at cryptocrack.de>
---
 web/html/home.php | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/web/html/home.php b/web/html/home.php
index e80efaa..62c246a 100644
--- a/web/html/home.php
+++ b/web/html/home.php
@@ -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
-- 
1.8.5.2



More information about the aur-dev mailing list