UX: Hotkey K can select partial posts

UX: Hotkey K can select partial posts

When no post is selected, K selects first partial post and J selects first full post.

diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js
index 4b5465b..5da8be5 100644
--- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js
+++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js
@@ -455,7 +455,11 @@ export default {
       const offset = minimumOffset();
       $selected = $articles
         .toArray()
-        .find(article => article.getBoundingClientRect().top > offset);
+        .find(article =>
+          direction > 0
+            ? article.getBoundingClientRect().top > offset
+            : article.getBoundingClientRect().bottom > offset
+        );
       if (!$selected) {
         $selected = $articles[$articles.length - 1];
       }

GitHub sha: 5715f0ad

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/k-hotkey-should-select-current-post-when-none-is-selected/143571/10