diff --git a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js index 1256dcc1467..f1cb8209e22 100644 --- a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js +++ b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js @@ -775,6 +775,11 @@ export default { if (article.getBoundingClientRect().height > 0) { break; } + + // Safeguard against infinite loops + if (direction === 0) { + break; + } } for (const a of articles) {