Skip to content

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

DEV: Add keyboard:move selection event (#15241)

Jeff Wong347669ef044d
diff --git a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
index f3bd4367c37..bf572e0eaab 100644
--- a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
+++ b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js
@@ -682,6 +682,10 @@ export default {
if ($article.length > 0) {
$articles.removeClass("selected");
$article.addClass("selected");
+ this.appEvents.trigger("keyboard:move-selection", {
+ articles: $articles.get(),
+ selectedArticle: $article.get(0),
+ });
const articleRect = $article[0].getBoundingClientRect();
if (!fast && direction < 0 && articleRect.height > window.innerHeight) {