Skip to content

Commit

Permalink
fix(button): apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SisIvanova committed Apr 30, 2024
1 parent 48989d1 commit 395c615
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions projects/igniteui-angular/src/lib/directives/button/button-base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { AfterViewInit, Directive, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, Optional, Output, booleanAttribute } from '@angular/core';
import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, Optional, Output, booleanAttribute } from '@angular/core';
import { DisplayDensityBase, DisplayDensityToken, IDisplayDensityOptions } from '../../core/density';
import { mkenum } from '../../core/utils';
import { fromEvent } from 'rxjs';

export const IgxBaseButtonType = /*@__PURE__*/mkenum({
Flat: 'flat',
Expand All @@ -10,7 +9,7 @@ export const IgxBaseButtonType = /*@__PURE__*/mkenum({
});

@Directive()
export abstract class IgxButtonBaseDirective extends DisplayDensityBase implements AfterViewInit {
export abstract class IgxButtonBaseDirective extends DisplayDensityBase {
/**
* Emitted when the button is clicked.
*/
Expand Down Expand Up @@ -59,7 +58,7 @@ export abstract class IgxButtonBaseDirective extends DisplayDensityBase implemen
* ```
*/
@HostBinding('class.igx-button--focused')
public focused = false;
protected focused = false;

/**
* Enables/disables the button.
Expand Down Expand Up @@ -90,16 +89,11 @@ export abstract class IgxButtonBaseDirective extends DisplayDensityBase implemen
super(_displayDensityOptions, element);
}

public ngAfterViewInit() {
fromEvent(this.nativeElement, 'keyup').subscribe((event: KeyboardEvent) => {
this.updateOnKeyUp(event)
});
}

/**
* @hidden
* @internal
*/
@HostListener('keyup', ['$event'])
protected updateOnKeyUp(event: KeyboardEvent) {
if (event.key === "Tab") {
this.focused = true;
Expand Down

0 comments on commit 395c615

Please sign in to comment.