diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php
index fdc58f59b3..c04f9468a9 100644
--- a/html/includes/print-menubar.php
+++ b/html/includes/print-menubar.php
@@ -814,9 +814,6 @@ if ($(window).width() < 768) {
devices.initialize();
ports.initialize();
bgp.initialize();
-$('#gsearch').bind('typeahead:select', function(ev, suggestion) {
- window.location.href = suggestion.url;
-});
$('#gsearch').typeahead({
hint: true,
highlight: true,
@@ -857,9 +854,13 @@ $('#gsearch').typeahead({
header: '
BGP Sessions
',
suggestion: Handlebars.compile('{{{bgp_image}}} {{name}} - {{hostname}}
AS{{localas}} -> AS{{remoteas}}
')
}
-});
-$('#gsearch').bind('typeahead:open', function(ev, suggestion) {
- $('#gsearch').addClass('search-box');
+}).on('typeahead:select', function(ev, suggestion) {
+ window.location.href = suggestion.url;
+}).on('keyup', function(e) {
+ // on enter go to the first selection
+ if(e.which === 13) {
+ $('.tt-selectable').first().click();
+ }
});
diff --git a/resources/views/layouts/menu.blade.php b/resources/views/layouts/menu.blade.php
index 2d63ba9b83..46f33a7169 100644
--- a/resources/views/layouts/menu.blade.php
+++ b/resources/views/layouts/menu.blade.php
@@ -470,9 +470,6 @@
devices.initialize();
ports.initialize();
bgp.initialize();
- $('#gsearch').bind('typeahead:select', function(ev, suggestion) {
- window.location.href = suggestion.url;
- });
$('#gsearch').typeahead({
hint: true,
highlight: true,
@@ -513,8 +510,12 @@
header: ' BGP Sessions
',
suggestion: Handlebars.compile('@{{bgp_image}} @{{name}} - @{{hostname}}
AS@{{localas}} -> AS@{{remoteas}}
')
}
+ }).on('typeahead:select', function (ev, suggestion) {
+ window.location.href = suggestion.url;
+ }).on('keyup', function (e) {
+ // on enter go to the first selection
+ if (e.which === 13) {
+ $('.tt-selectable').first().click();
+ }
});
- $('#gsearch').bind('typeahead:open', function(ev, suggestion) {
- $('#gsearch').addClass('search-box');
- });