Not possiblw to make focus work

What I’m trying to do is a listing app. It must have two main features:

  • It’s possible adding new list items by simply typing any letter in the first input item. Entering any letters on the second input, opens up a new input item below them; and so on …
  • When opening the page for the first time, the first input item (the only one on the page so far) must gain the focus.

The first item I could do, but the second no; when I type in the first input item, the second one is added as expected; but the first input loses the focus, as not expected, as I wanted to keep typing in it.