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 authored and daniel committed Jul 15, 2019
1 parent feae069 commit bc9f809
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/time-picker/nz-time-picker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
[placeholder]="nzPlaceHolder || ('TimePicker.placeholder' | nzI18n)"
[(ngModel)]="value"
readonly="readonly"
(click)="open()">
(click)="open()"
(keyup.enter)="open()">
<span class="ant-time-picker-icon">
<i nz-icon nzType="clock-circle"></i>
</span>
Expand Down Expand Up @@ -50,7 +51,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 @@ -143,6 +143,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 bc9f809

Please sign in to comment.