leodido/ng-caret-aware

Click after selection does not fire caret value change

leodido opened this issue · 0 comments

Scenario:

  1. You have selected a part of the text in a caret-aware input.
  2. When you release mouse the caret position is equivalent to the starting point of the selection
  3. Selection is already visible
  4. You click in the middle of the selection
  5. The caret variable value is not updated to the position you just clicked

This happens because when you click, the selectionStart (or IE equivalent) variable has not yet been updated, so the call to ctrl.getPosition() returns a value equal to the previous.