Skip to content

Commit

Permalink
fix(combobox): fix issue causing value to be cleared when selecting a…
Browse files Browse the repository at this point in the history
…n item (Windows + trackpad) (#7954)

**Related Issue:** #7934 

## Summary

Updates the component to consistently bail on blur handling logic if the
input is blurred, but focus is still within the component.

### Notes

* the regression was introduced by
#7721
* due to time constraints, testing will be tackled in a follow-up issue
as it's not easy to reproduce in an E2E test.
  • Loading branch information
jcfranco authored Oct 5, 2023
1 parent fe93470 commit 557d658
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/calcite-components/src/components/combobox/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -761,19 +761,19 @@ export class Combobox
this.updateActiveItemIndex(targetIndex);
}

setInactiveIfNotContained = (event: Event): void => {
private setInactiveIfNotContained = (event: Event): void => {
const composedPath = event.composedPath();

if (!this.open || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
return;
}

if (!this.allowCustomValues && this.textInput.value) {
this.clearInputValue();
this.filterItems("");
this.updateActiveItemIndex(-1);
}

if (!this.open || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
return;
}

if (this.allowCustomValues && this.text.trim().length) {
this.addCustomChip(this.text);
}
Expand Down

0 comments on commit 557d658

Please sign in to comment.