Focusing inputs dynamically added to LiveView form?

This sample from the live view docs JavaScript interoperability — Phoenix LiveView v1.2.5 shows how to push events to highlight elements from the server. The same could be done for focusing a new input.

Add the push event to the socket when handling the event that makes the changes to the form.

Basically like push_event/3 window event example but executing .focus() on the element.