Skip to content

Commit

Permalink
fix(module:time-picker): make keyboard navigation possible
Browse files Browse the repository at this point in the history
Tabbing away from time-picker overlay was not possible: It wrapped
around and usually ended up in browser's address bar. Also, once you
selected time-picker wrapper span, there was no way to open the overlay
via keyboard.
This fixes this. Tabbing away from overlay now focuses on time-picker
wrapper span. Pressing enter on the wrapper span opens the overlay.
  • Loading branch information
jimmytheneutrino committed Mar 27, 2019
1 parent fbfb4da commit 89f1d87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/time-picker/nz-time-picker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[(ngModel)]="value"
readonly="readonly"
(click)="open()"
(keyup.enter)="open()"
#inputElement>
<span class="ant-time-picker-icon">
<i nz-icon type="clock-circle"></i>
Expand Down Expand Up @@ -49,7 +50,9 @@
[opened]="nzOpen"
[nzClearText]="nzClearText"
[nzAllowEmpty]="nzAllowEmpty"
(keyup.enter)="close()"
[(ngModel)]="value">
</nz-time-picker-panel>
<span tabindex="0" (focus)="close()" class="nz-tab-catching-span"></span>
</ng-template>

1 change: 1 addition & 0 deletions components/time-picker/nz-time-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export class NzTimePickerComponent implements ControlValueAccessor, OnInit, Afte
close(): void {
this.nzOpen = false;
this.nzOpenChange.emit(this.nzOpen);
this.focus();
}

updateAutoFocus(): void {
Expand Down

0 comments on commit 89f1d87

Please sign in to comment.