diff --git a/framework/core/js/src/forum/components/Search.tsx b/framework/core/js/src/forum/components/Search.tsx index 8224452ca..af15a207c 100644 --- a/framework/core/js/src/forum/components/Search.tsx +++ b/framework/core/js/src/forum/components/Search.tsx @@ -325,9 +325,10 @@ export default class Search extends Compone /** * Get the position of the currently selected search result item. + * Returns zero if not found. */ getCurrentNumericIndex(): number { - return this.selectableItems().index(this.getItem(this.index)); + return Math.max(0, this.selectableItems().index(this.getItem(this.index))); } /**