mirror of
https://github.com/flarum/core.git
synced 2025-08-03 15:07:53 +02:00
Fix active search jumping to last item during loading
This commit is contained in:
committed by
Daniël Klabbers
parent
dfab94ae8a
commit
ef6040a0a8
@@ -325,9 +325,10 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the position of the currently selected search result item.
|
* Get the position of the currently selected search result item.
|
||||||
|
* Returns zero if not found.
|
||||||
*/
|
*/
|
||||||
getCurrentNumericIndex(): number {
|
getCurrentNumericIndex(): number {
|
||||||
return this.selectableItems().index(this.getItem(this.index));
|
return Math.max(0, this.selectableItems().index(this.getItem(this.index)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user