From eaf0cf05193f4325e3f8e4aa7d230c009a0b46a0 Mon Sep 17 00:00:00 2001 From: cpradio Date: Mon, 15 Sep 2014 21:10:24 -0400 Subject: [PATCH] FIX: Using k on Firefox to navigate up the topic list Using k wouldn't always bring the topic in focus as you moved up the topic list https://meta.discourse.org/t/topic-list-keyboard-shortcut-previous-k-does-not-scroll-properly-leaving-selected-item-hidden-firefox/20050 --- app/assets/javascripts/discourse/lib/keyboard_shortcuts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js index f6e76f8c5af..c566aeafa1b 100644 --- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js +++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js @@ -243,8 +243,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ }, _scrollList: function($article, direction) { - var $body = $('body'), - distToElement = $article.position().top + $article.height() - $(window).height() - $body.scrollTop(); + var $document = $(document), + distToElement = $article.position().top + $article.height() - $(window).height() - $document.scrollTop(); // cut some bottom slack distToElement += 40; @@ -254,7 +254,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ return; } - $('html, body').scrollTop($body.scrollTop() + distToElement); + $('html, body').scrollTop($document.scrollTop() + distToElement); }, _findArticles: function() {