Skip to content

Commit 92d3351

Browse files
committed
chore(time-picker): move host listener up #6482
1 parent fa790a6 commit 92d3351

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

Diff for: projects/igniteui-angular/src/lib/time-picker/time-picker.component.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,30 @@ export class IgxTimePickerComponent extends PickerBaseDirective
632632
super(element, _localeId, _displayDensityOptions, _inputGroupType);
633633
}
634634

635+
/** @hidden @internal */
636+
@HostListener('keydown', ['$event'])
637+
public onKeyDown(event: KeyboardEvent): void {
638+
switch (event.key) {
639+
case this.platform.KEYMAP.ARROW_UP:
640+
if (event.altKey && this.isDropdown) {
641+
this.close();
642+
}
643+
break;
644+
case this.platform.KEYMAP.ARROW_DOWN:
645+
if (event.altKey && this.isDropdown) {
646+
this.open();
647+
}
648+
break;
649+
case this.platform.KEYMAP.ESCAPE:
650+
this.cancelButtonClick();
651+
break;
652+
case this.platform.KEYMAP.SPACE:
653+
this.open();
654+
event.preventDefault();
655+
break;
656+
}
657+
}
658+
635659
// #region ControlValueAccessor
636660

637661
/** @hidden @internal */
@@ -1036,30 +1060,6 @@ export class IgxTimePickerComponent extends PickerBaseDirective
10361060
return this._ampmView.filter((ampm) => ampm !== '');
10371061
}
10381062

1039-
/** @hidden @internal */
1040-
@HostListener('keydown', ['$event'])
1041-
public onKeyDown(event: KeyboardEvent): void {
1042-
switch (event.key) {
1043-
case this.platform.KEYMAP.ARROW_UP:
1044-
if (event.altKey && this.isDropdown) {
1045-
this.close();
1046-
}
1047-
break;
1048-
case this.platform.KEYMAP.ARROW_DOWN:
1049-
if (event.altKey && this.isDropdown) {
1050-
this.open();
1051-
}
1052-
break;
1053-
case this.platform.KEYMAP.ESCAPE:
1054-
this.cancelButtonClick();
1055-
break;
1056-
case this.platform.KEYMAP.SPACE:
1057-
this.open();
1058-
event.preventDefault();
1059-
break;
1060-
}
1061-
}
1062-
10631063
protected onStatusChanged() {
10641064
if ((this._ngControl.control.touched || this._ngControl.control.dirty) &&
10651065
(this._ngControl.control.validator || this._ngControl.control.asyncValidator)) {

0 commit comments

Comments
 (0)