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) {
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() {