Perspective: How can I focus on a text field with the text cursor so that you don't need to click on it before typing?

The text field is initially hidden, but after a button click I'd like to have the text field become visible with the text cursor.

you can call focus on the component
.focus()

tried this but I still need to click the text field before I can type

Are we certain you're using a component that has the .focus() method?
https://docs.inductiveautomation.com/display/DOC81/Perspective+Component+Methods#PerspectiveComponentMethods-RequestingFocus

But where are you doing this? Could you please share the code which changes the display state of the component in conjunction with the code which requests focus on that component?

I got it to work but I noticed when I used a barcode scanner, the cursor would disappear from the text field after whatever is scanned is inputted

Probably because the Barcode Scanner is requesting focus.