Skip to content

Commit

Permalink
fix(module:select): fix space closing select panel (#2240)
Browse files Browse the repository at this point in the history
close #2201
  • Loading branch information
Wendell authored and vthinkxie committed Oct 11, 2018
1 parent ebf151a commit 3d7fe39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/select/nz-select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ export class NzSelectComponent implements ControlValueAccessor, OnInit, AfterVie
event.preventDefault();
}
} else {
if (keyCode === SPACE || keyCode === TAB) {
if (keyCode === TAB) {
// if (keyCode === SPACE || keyCode === TAB) { // #2201
this.nzOpen = false;
this.nzOpenChange.emit(this.nzOpen);
event.preventDefault();
Expand Down
3 changes: 2 additions & 1 deletion components/select/nz-select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ describe('nz-select component', () => {
flush();
fixture.detectChanges();
expect(testComponent.open).toBe(true);
dispatchKeyboardEvent(select.nativeElement.querySelector('.ant-select-selection'), 'keydown', SPACE);
// #2201, space should not close select panel
dispatchKeyboardEvent(select.nativeElement.querySelector('.ant-select-selection'), 'keydown', TAB);
fixture.detectChanges();
flush();
fixture.detectChanges();
Expand Down

0 comments on commit 3d7fe39

Please sign in to comment.