Skip to content

Commit

Permalink
Merge pull request #6500 from Rekl0w/Fix#6499
Browse files Browse the repository at this point in the history
Fix #6499: Listbox  focused option index fix
  • Loading branch information
nitrogenous authored Apr 30, 2024
2 parents dbd2d33 + ecbc3e3 commit 681a1aa
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions components/lib/listbox/ListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export const ListBox = React.memo(
const len = target.value.length;

target.setSelectionRange(len, len);
focusedOptionIndex = -1;
setFocusedOptionIndex(-1);
} else {
let metaKey = event.metaKey || event.ctrlKey;
let optionIndex = findLastOptionIndex();
Expand Down Expand Up @@ -580,13 +580,6 @@ export const ListBox = React.memo(
return isEquals(props.value, optionValue);
};

const filter = (option) => {
const filterValue = filteredValue.trim().toLocaleLowerCase(props.filterLocale);
const optionLabel = getOptionLabel(option).toLocaleLowerCase(props.filterLocale);

return optionLabel.indexOf(filterValue) > -1;
};

const getOptionLabel = (option) => {
return props.optionLabel ? ObjectUtils.resolveFieldData(option, props.optionLabel) : option && option.label !== undefined ? option.label : option;
};
Expand Down Expand Up @@ -638,7 +631,7 @@ export const ListBox = React.memo(
autoUpdateModel(true);
};

const onListBlur = (event) => {
const onListBlur = () => {
setFocused(false);
setFocusedOptionIndex(-1);
setStartRangeIndex(-1);
Expand Down

0 comments on commit 681a1aa

Please sign in to comment.