Set cursor to end in sp-textfield

Hi all,

I’m new to UXP development and this is my first time posting here :waving_hand:

In my InDesign plugin I’m using an sp-textfield where users can type formulas.
After programmatically inserting text (like an operator), I want to move the cursor to the end of the textfield value.

In regular HTML inputs or textareas, I’d use selectionStart and selectionEnd to do this. But sp-textfield doesn’t seem to expose these.

Is there a way to create a simple function like cursorToEnd(textfield) that moves the caret to the end of the value in an sp-textfield?

Any help is much appreciated — thanks!