mirror of
https://github.com/flarum/framework.git
synced 2025-02-26 18:15:26 +08:00
Fix active search jumping to last item during loading
This commit is contained in:
parent
2d18d37ba9
commit
edd93dad77
@ -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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user