Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent combobox from complaining about long search values #3797

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- Updated lodash to `v4.17.19` ([#3764](https://github.com/elastic/eui/pull/3764))
- Added `returnKey` glyph to `EuiIcon` ([#3783](https://github.com/elastic/eui/pull/3783))

**Bug fixes**

- Fixed `EuiComboBox` marking some very long inputs as invalid ([#3797](https://github.com/elastic/eui/pull/3797))

## [`27.2.0`](https://github.com/elastic/eui/tree/v27.2.0)

- Added `analyzeEvent` glyph in `EuiIcon` ([#3729](https://github.com/elastic/eui/pull/3729))
Expand Down
10 changes: 8 additions & 2 deletions src/components/combo_box/combo_box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ export class EuiComboBox<T> extends Component<
});
};

closeList = () => {
closeList = (event?: Event) => {
if (event && event.target === this.searchInputRefInstance) {
// really long search values / custom entries triggers a scroll event on the input
// which the EuiComboBoxOptionsList passes through here
return;
}

this.clearActiveOption();
this.setState({
listZIndex: undefined,
Expand Down Expand Up @@ -674,7 +680,7 @@ export class EuiComboBox<T> extends Component<
}

if (singleSelection) {
requestAnimationFrame(this.closeList);
requestAnimationFrame(() => this.closeList());
} else {
this.setState({
activeOptionIndex: this.state.matchingOptions.indexOf(addedOption),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export type EuiComboBoxOptionsListProps<T> = CommonProps &
isLoading?: boolean;
listRef: RefCallback<HTMLDivElement>;
matchingOptions: Array<EuiComboBoxOptionOption<T>>;
onCloseList: () => void;
onCloseList: (event: Event) => void;
onCreateOption?: (
searchValue: string,
options: Array<EuiComboBoxOptionOption<T>>
Expand Down Expand Up @@ -174,7 +174,7 @@ export class EuiComboBoxOptionsList<T> extends Component<
event.target &&
this.listRefInstance.contains(event.target as Node) === false
) {
this.props.onCloseList();
this.props.onCloseList(event);
}
};

Expand Down