Skip to content

A platform for community discussion. Free, open, simple.

FIX: Fallback to last post when the in-view post cannot be detected.

Dan Ungureanu7a7c6af21e71
diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6
index 97817f8bd13..000cc335a4c 100644
--- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6
+++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6
@@ -445,6 +445,9 @@ export default {
$selected = $articles
.toArray()
.find(article => article.getBoundingClientRect().top > offset);
+ if (!$selected) {
+ $selected = $articles[$articles.length - 1];
+ }
direction = 0;
}