If you want to make a non-focusable element focusable, you must add a
tabindex attribute to it and div falls in that category .
More on tabIndex
use some thing like this
<div tabindex="1"></div>
or even make a directive for the same which will help you customize the functionality
import { Directive, Input, ElementRef, Inject, OnChanges } from '@angular/core';
@Directive({ selector: '[focusField]' })
export class FocusDirective implements OnChanges {
@Input('focusField') focusField: any;
constructor(@Inject(ElementRef) private element: ElementRef) { }
ngOnChanges(changes){
if(changes.focusField.currentValue){
this.element.nativeElement.focus();
}
}
}