Skip to content

autocomplete messes up the caret position in IE9 #95

Description

@banku

I am using the latest version of the keyboard (Version 1.12) and autocomplete extension (v1.3).

Steps to reproduce bug: Have a textbox attached to keyboard with autocomplete plug in. Set focus on the textbox and add one or two characters using the virtual keyboard so that the autocomplete suggestions show up. Select an autocomplete selection.

Result:The selection shows up on the target textbox and the caret moves to the end which is all good.

Bug: After this, when you move the mouse to a key on the virtual keyboard and then move the mouse out of it, the caret position moves back to it's original position. For e.g. if two characters were entered before using autocomplete, the caret position will go back to the position after 2 characters.

Expected result: Caret position should stay at the end.

I know that this happens when the below code is executed:
.bind('mouseup.keyboard mouseleave.kb touchend.kb touchmove.kb touchcancel.kb', function(){
if (base.isVisible() && base.isCurrent()) { base.$preview.focus(); }
base.mouseRepeat = [false,''];
clearTimeout(base.repeater); // make sure key repeat stops!
if (base.checkCaret) { base.$preview.caret( base.lastCaret.start, base.lastCaret.end ); }
return false;
})

So I guess that the fix should be setting base.lastCaret properly when the textbox is updated using autocomplete selection. Does that make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions