Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2745
Caret position after selection
posted

When selecting an item where the text length is greater than input box, the caret is positioned at the end of the text in IE8 and IE9.  In IE10, IE11, Firefox and Chrome the caret is repositioned at the beginning.  I captured the igcomboselectionchanged event then selected a dummy input then set the focus back on the original control which fixes the issue in IE8 and IE9, but causes IE10, IE11, Firefox and Chrome to behave how IE8 and IE9 used too.  It moves the caret at the end after a selection.

 

I want the mouse cursor (caret) to be at the beginning of the text after selection and not at the end.  This only applies to selections where the text/value exceeds the length of the input.

 

| == Caret
[ == Start of input
] == End of input

IE8, IE9
The brown fox [fox jumps over the lazy dog.|]

IE10+, Firefox, Chrome
[|The brown fox jumps over] the lazy dog.

 

Thanks,

  • 49378
    Suggested Answer
    posted

    Hello Daniel,

    After testing this scenario in Ie7/8/9/10, Firefox and Chrome, all browsers seemed to handle long text in the same way, namely putting the caret position at the end. I have created a small sample illustrating how this can be prevented, and the cursor placed at the beginning of the input field by handling theselectionChangedevent. The sample is attached for your reference.

     

    Please do not hesitate to contact me if you have any questions regarding this matter.

    json-binding.zip