angular-ui / ui-mask

Mask on an input field so the user can only type pre-determined pattern
https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html
MIT License
391 stars 258 forks source link

Cursor positioned incorrectly when all characters selected #205

Open sferguson12 opened 7 years ago

sferguson12 commented 7 years ago

If all characters in a masked field are selected and the user presses cursor left, the cursor is bumped one extra position to the right of the leftmost masked character. For example:

(800)555-1212 => Select all => Cursor left => Cursor is positioned after the 8 123-45-6789 => Select all => Cursor left => Cursor is positioned after the 1

This appears to be related to how the isAddition property is getting set in eventHandler(). I'm using v1.8.7.

The issue is illustrated here: http://codepen.io/sferguson12/pen/LbwrOZ