Please see here:
https://github.com/kekeh/angular-mydatepicker/blob/master/projects/angular-mydatepicker/src/lib/components/calendar/calendar.component.ts#L559
It looks like elem is assigned uselessly. When the line is deleted, then most of the if block is also useless. Is there a missing elem.focus() here?