Skip to content

Commit

Permalink
Fix focus on blur
Browse files Browse the repository at this point in the history
  • Loading branch information
Zefling committed Aug 29, 2023
1 parent 8bf72cc commit 87f6860
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions projects/ng-select2-component/src/lib/select2.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,14 @@ export class Select2 implements ControlValueAccessor, OnInit, DoCheck, AfterView
} else if (this._testKey(event, ['ArrowDown', 'ArrowUp', 'Enter', 40, 38, 13])) {
this.toggleOpenAndClose(true, true, event);
event.preventDefault();
} else if (this._testKey(event, ['Escape', 'Tab', 9, 27]) && this.isOpen) {
this.toggleOpenAndClose(false);
event.preventDefault();
this._onTouched();
} else if (this._testKey(event, ['Escape', 'Tab', 9, 27])) {
if (this.isOpen) {
this.toggleOpenAndClose(false);
this._onTouched();
event.preventDefault();
} else {
this._focus(false);
}
}
}

Expand Down

0 comments on commit 87f6860

Please sign in to comment.