TextField - Setting cursor index at the end of value?

I’m trying to replace the value of a TextField with another value. For example: "Hello" to "Hello World"

Each time I do this, I want the cursor index to be placed at the end of the value, so I set the cursor index:
textField.cursorIndex = textField.value.Length

With the example I gave, the cursor index is being set to 5, but I expected 11, which would be at the end of "Hello World"

However, if I do it the other way around by changing from "Hello World" to "Hello" the cursor index is correclty being set to 5.

I am not sure if this is a bug, or if I could do it any other way?

You can get the Scroller element in code with

var scroller = textField.Q<Scroller>();

and set it’s value

scroller.value = scroller.highValue;

But I guess you mean the cursor position inline?