Locking it down a little soon, don't you think?
Here's a better way:
<<textbox '$UD' '' autofocus>>
<span id='report'></span>
<<link 'Go!'>>
<<if Story.has($UD)>>
<<goto $UD>>
<<else>>
<<replace '#report'>>\
No such universe exists!\
<</replace>>
<</if>>
<</link>>
Some notes:
If this code doesn't work then you're on sugarcube 1, try switching to sugarcube 2. If you don't want to switch (you should), let me know and I'll whip up some code for 1 for you.
If your answer involves writing out several hundred lines of code, then it isn't a good answer, and you probably shouldn't shut down your question. That's not a dig at you. I just hope that future readers get this far before writing all that code or giving up.
Also, here's a definition of focus:
https://javascript.info/focus-blur
All autofocus does is make the element receive focus as soon as it shows up. It isn't some kind of passage traversal mechanism.