Chocobozzz/PeerTube

View on GitHub
client/src/app/shared/shared-main/common/autofocus.directive.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { AfterViewInit, Directive, ElementRef } from '@angular/core'

@Directive({
  selector: '[myAutofocus]',
  standalone: true
})
export class AutofocusDirective implements AfterViewInit {
  constructor (private host: ElementRef) { }

  ngAfterViewInit () {
    const el = this.host.nativeElement as HTMLElement

    el.focus({ preventScroll: true })
  }
}