You can’t, at least not in iOS (iPhone), and I believe Android as well. It’s a usability issue that the keyboard should not be allowed to be triggered except by user input (it’s just annoying if it’s automatic).
There are a couple of ways I know of to get around this:
prompt()
opens the keyboard- If you trigger the
.focus()
from within a.click()
event (e.g. from opening your dialog), the keyboard shows up