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
This commit is contained in:
cpradio 2014-09-15 21:10:24 -04:00
parent 4e5e7d718e
commit eaf0cf0519
1 changed files with 3 additions and 3 deletions

View File

@ -243,8 +243,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
}, },
_scrollList: function($article, direction) { _scrollList: function($article, direction) {
var $body = $('body'), var $document = $(document),
distToElement = $article.position().top + $article.height() - $(window).height() - $body.scrollTop(); distToElement = $article.position().top + $article.height() - $(window).height() - $document.scrollTop();
// cut some bottom slack // cut some bottom slack
distToElement += 40; distToElement += 40;
@ -254,7 +254,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
return; return;
} }
$('html, body').scrollTop($body.scrollTop() + distToElement); $('html, body').scrollTop($document.scrollTop() + distToElement);
}, },
_findArticles: function() { _findArticles: function() {