When a string is added to the value of text input field with a script multiple times and the length of the value in the field becomes longer than the width of the field (so that only a part of the value in the input field is visible),
the caret is at the end of the string in the field. However, the rightmost part of the visible string does not coincide with the end of the value in the field (and the caret position). So, the caret is not visible.
When the same sequence of strings are typed directly, the 'visible window' of the value moves along as the value becomes wider than the width.
Created attachment 31205 [details]
After loading this test page, click on the button multiple times. Everytime it's clicked, '123' and 'abc' are appended in turn. When the string in the text input field is too long to be shown in the input box, the caret is at the end of the string. However, the end of the 'visible' string 'lags' behind by 'one click'. That is, it's not where the current caret is but is at the end of the previous 'append'.
bug 25444 might be related to this.