diff --git a/core/src/components/reorder-group/reorder-group.tsx b/core/src/components/reorder-group/reorder-group.tsx index d3f43fd1336..62b3bdb80c7 100644 --- a/core/src/components/reorder-group/reorder-group.tsx +++ b/core/src/components/reorder-group/reorder-group.tsx @@ -245,17 +245,16 @@ export class ReorderGroup implements ComponentInterface { private itemIndexForTop(deltaY: number): number { const heights = this.cachedHeights; - let i = 0; // TODO: since heights is a sorted array of integers, we can do // speed up the search using binary search. Remember that linear-search is still // faster than binary-search for small arrays (<64) due CPU branch misprediction. - for (i = 0; i < heights.length; i++) { + for (let i = 0; i < heights.length; i++) { if (heights[i] > deltaY) { - break; + return i; } } - return i; + return heights.length - 1; } /********* DOM WRITE ********* */