Skip to content

Commit

Permalink
fix(module:auto-complete): enter-keydown event should not be prevent …
Browse files Browse the repository at this point in the history
…when the panel is closed (NG-ZORRO#3342)

* fix(module:auto-complete): enter-keydown event should not be prevent when the panel is closed

close NG-ZORRO#3340

* chore(module:auto-complete): clean code
  • Loading branch information
hsuanxyz authored and Ricbet committed Apr 9, 2020
1 parent 4ff7692 commit 7048e11
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ export class NzAutocompleteTriggerDirective implements ControlValueAccessor, OnD
}
this.closePanel();
} else if (this.panelOpen && keyCode === ENTER) {
event.preventDefault();
if (this.nzAutocomplete.showPanel && this.activeOption) {
event.preventDefault();
this.activeOption.selectViaInteraction();
}
} else if (this.panelOpen && isArrowKey && this.nzAutocomplete.showPanel) {
event.stopPropagation();
event.preventDefault();
if (keyCode === UP_ARROW) {
this.nzAutocomplete.setPreviousItemActive();
} else {
Expand Down

0 comments on commit 7048e11

Please sign in to comment.