feat(input, textarea): expose native events for ionBlur and ionFocus (#21777)

resolves #17363
This commit is contained in:
Liam DeBeasi
2020-07-17 17:43:17 -04:00
committed by GitHub
parent 77464ef21a
commit a625c837a6
7 changed files with 25 additions and 24 deletions

View File

@ -201,12 +201,12 @@ export class Input implements ComponentInterface {
/**
* Emitted when the input loses focus.
*/
@Event() ionBlur!: EventEmitter<void>;
@Event() ionBlur!: EventEmitter<FocusEvent>;
/**
* Emitted when the input has focus.
*/
@Event() ionFocus!: EventEmitter<void>;
@Event() ionFocus!: EventEmitter<FocusEvent>;
/**
* Emitted when the styles change.
@ -293,20 +293,20 @@ export class Input implements ComponentInterface {
this.ionInput.emit(ev as KeyboardEvent);
}
private onBlur = () => {
private onBlur = (ev: FocusEvent) => {
this.hasFocus = false;
this.focusChanged();
this.emitStyle();
this.ionBlur.emit();
this.ionBlur.emit(ev);
}
private onFocus = () => {
private onFocus = (ev: FocusEvent) => {
this.hasFocus = true;
this.focusChanged();
this.emitStyle();
this.ionFocus.emit();
this.ionFocus.emit(ev);
}
private onKeydown = (ev: KeyboardEvent) => {