Skip to content

Commit

Permalink
fix(dropdown): improve input handling for multiselect during focus an…
Browse files Browse the repository at this point in the history
…d blur events
  • Loading branch information
ckrook authored and theJohnnyMe committed Oct 16, 2024
1 parent 15edb63 commit 483eb85
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -529,18 +529,22 @@ export class TdsDropdown {
class={`${this.labelPosition === 'inside' ? 'placeholder' : ''}`}
type="text"
placeholder={this.filterFocus ? '' : this.placeholder}
value={this.filterFocus ? '' : this.getValue()}
value={this.multiselect && this.filterFocus ? '' : this.getValue()}
disabled={this.disabled}
onInput={(event) => this.handleFilter(event)}
onBlur={(event) => {
this.filterFocus = false;
this.inputElement.value = this.getValue();
if (this.multiselect) {
this.inputElement.value = this.getValue();
}
this.handleBlur(event);
}}
onFocus={(event) => {
this.open = true;
this.filterFocus = true;
this.inputElement.value = '';
if (this.multiselect) {
this.inputElement.value = '';
}
this.handleFocus(event);
this.handleFilter({ target: { value: '' } });
}}
Expand Down

0 comments on commit 483eb85

Please sign in to comment.