mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 22:44:55 +00:00
fixed autofocus in input fields (fixes #374)
This commit is contained in:
15
terminus-core/src/directives/autofocus.directive.ts
Normal file
15
terminus-core/src/directives/autofocus.directive.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Directive, AfterViewInit, ElementRef } from '@angular/core'
|
||||
|
||||
@Directive({
|
||||
selector: '[autofocus]'
|
||||
})
|
||||
export class AutofocusDirective implements AfterViewInit {
|
||||
constructor (private el: ElementRef) { }
|
||||
|
||||
ngAfterViewInit () {
|
||||
this.el.nativeElement.blur()
|
||||
setTimeout(() => {
|
||||
this.el.nativeElement.focus()
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user