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 (#3342)

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

close #3340

* chore(module:auto-complete): clean code
  • Loading branch information
hsuanxyz authored and Wendell committed Apr 25, 2019
1 parent 963f415 commit 414b428
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 414b428

Please sign in to comment.