Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2198x 2198x 2198x 2198x 1x 1x 1x 1x 1x 2147x 1x 1x 1x 1x 156x 1x 1x 1x 1x 337x 1x 1x 1x 530x 1x 1x | import { Directive, ElementRef, HostListener } from '@angular/core'; import { FocusScopeDirective } from './focus-scope.directive'; @Directive({ selector: '[gc-focus-target]' }) export class FocusTargetDirective { get scope(): FocusScopeDirective { return this._scope; } set scope(scope: FocusScopeDirective) { this._scope = scope; } public _scope!: FocusScopeDirective; constructor( private el: ElementRef/*, Fails in storybook hence done in done in FocusScopeDirective private scope: FocusScopeDirective*/) {} @HostListener('blur') onBlur(): void { this.scope.onTargetBlur(); } @HostListener('focus') onFocus(): void { this.scope.onTargetFocus(); } isFocused(): boolean { return this.el.nativeElement == document.activeElement; } } |