Skip to content

Commit d31ac97

Browse files
committed
Switch from handling keyup to input events
(because the former fires for modifier keys that shouldn't open the menu)
1 parent a717eb7 commit d31ac97

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/labs/ia-combo-box/ia-combo-box.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ export class IAComboBox extends LitElement {
402402
?disabled=${this.disabled}
403403
?required=${this.required}
404404
@click=${this.handleComboBoxClick}
405-
@keydown=${this.handleTextInputKeyDown}
406-
@keyup=${this.handleTextInputKeyUp}
405+
@keydown=${this.handleTextBoxKeyDown}
406+
@input=${this.handleTextBoxInput}
407407
@focus=${this.handleFocus}
408408
@blur=${this.handleBlur}
409409
/>
@@ -545,7 +545,7 @@ export class IAComboBox extends LitElement {
545545
/**
546546
* Handler for `keydown` events on various special keys.
547547
*/
548-
private handleTextInputKeyDown(e: KeyboardEvent): void {
548+
private handleTextBoxKeyDown(e: KeyboardEvent): void {
549549
switch (e.key) {
550550
case 'Enter':
551551
this.handleEnterPressed();
@@ -580,13 +580,9 @@ export class IAComboBox extends LitElement {
580580
}
581581

582582
/**
583-
* Handler for `keyup` events in the text input box.
583+
* Handler for `input` events in the text input box.
584584
*/
585-
private async handleTextInputKeyUp(e: KeyboardEvent): Promise<void> {
586-
if (['Enter', 'Escape', 'ArrowUp', 'ArrowDown', 'Tab'].includes(e.key)) {
587-
return;
588-
}
589-
585+
private async handleTextBoxInput(): Promise<void> {
590586
this.enteredText = this.textInput.value;
591587
this.setFilterText(this.textInput.value);
592588
this.openOptionsMenu();

0 commit comments

Comments
 (0)