From 4714d31c0190d8f6dcaf5ec7b6846b588f15d9b0 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 17 Jun 2013 16:23:03 +1000 Subject: [PATCH] fix scrolling while clicking up and down on search results --- .../search/topic_result.js.handlebars | 2 +- .../discourse/views/search/search_view.js | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/search/topic_result.js.handlebars b/app/assets/javascripts/discourse/templates/search/topic_result.js.handlebars index 37d58aed4..6e2fd5aee 100644 --- a/app/assets/javascripts/discourse/templates/search/topic_result.js.handlebars +++ b/app/assets/javascripts/discourse/templates/search/topic_result.js.handlebars @@ -1,5 +1,5 @@ {{#with view.content}} - + {{unbound title}} {{/with}} diff --git a/app/assets/javascripts/discourse/views/search/search_view.js b/app/assets/javascripts/discourse/views/search/search_view.js index f03f87671..c51bb6991 100644 --- a/app/assets/javascripts/discourse/views/search/search_view.js +++ b/app/assets/javascripts/discourse/views/search/search_view.js @@ -18,12 +18,18 @@ Discourse.SearchView = Discourse.View.extend({ return $('body').on('keydown.search', function(e) { if ($('#search-dropdown').is(':visible')) { switch (e.which) { - case 13: - return controller.select(); - case 38: - return controller.moveUp(); - case 40: - return controller.moveDown(); + case 13: + controller.select(); + e.preventDefault(); + break; + case 38: + controller.moveUp(); + e.preventDefault(); + break; + case 40: + controller.moveDown(); + e.preventDefault(); + break; } } });