npm install ngx-focus-control --saveFocus history directive and service
Directive stores focused elements into history and thanks to history service FocusHistoryService you can go back in focus history using focusHistoryService.focusPrevious(). Put FocusHistoryService into app module providers and then inject it into the component constructor(public readonly focusHistoryService: FocusHistoryService) from the ngx-focus-control package.
Example inputs and also history from History service (elements are mapped to only ids). Focus inputs multiple times and then click on the button, see history.