Skip to content

Commit

Permalink
fix Select focus move issue during loading, and allow moving to top a…
Browse files Browse the repository at this point in the history
…fter pressing down on the last option (#1558)
  • Loading branch information
HyczZhu authored Nov 23, 2020
1 parent b3304c8 commit 7117d19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/zent/src/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function defaultRenderOptionList<Item extends ISelectItem>(
}

function isSelectable<Item extends ISelectItem>(item: Item) {
return !item.disabled && !item.type;
return !!item && !item.disabled && !item.type;
}

function findNextSelectableOption<Item extends ISelectItem>(
Expand Down Expand Up @@ -435,7 +435,7 @@ export class Select<
nextIndex = 0;
}
} else {
nextIndex = state.activeIndex + delta;
nextIndex = (state.activeIndex + delta) % options.length;
}
if (nextIndex >= options.length) {
nextIndex = options.length - 1;
Expand Down

0 comments on commit 7117d19

Please sign in to comment.