From 3d7fe390d0951461b941c73d6159d5901e003f57 Mon Sep 17 00:00:00 2001 From: Wendell Date: Thu, 11 Oct 2018 16:59:34 +0800 Subject: [PATCH] fix(module:select): fix space closing select panel (#2240) close #2201 --- components/select/nz-select.component.ts | 3 ++- components/select/nz-select.spec.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/select/nz-select.component.ts b/components/select/nz-select.component.ts index 2a12ab5bc12..4911f2a8df6 100644 --- a/components/select/nz-select.component.ts +++ b/components/select/nz-select.component.ts @@ -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(); diff --git a/components/select/nz-select.spec.ts b/components/select/nz-select.spec.ts index c909118bb26..e25207315f0 100644 --- a/components/select/nz-select.spec.ts +++ b/components/select/nz-select.spec.ts @@ -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();