p-inputmask: when adding required property cursor doesn't go at the begining of mask
Describe the bug
If required property is added to p-inputmask behaviour of cursor changes. Instead of going at the beginning of the mask it goes closest to place where click occurs.
Click in the middle of p-inputmask with required property:
Click in the middle of p-inputmask without required property:

Environment
ng serve
Reproducer
https://primeng-inputmask-demo-2qppbg.stackblitz.io
Angular version
15.1.3
PrimeNG version
15.2.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
16.14.0
Browser(s)
firefox, chrome
Steps to reproduce the behavior
- Click in the middle or near to right side of p-inputmask with required property
- Cursor is in the middle or at the end of mask
Expected behavior
Cursor should be at the beginning of mask
I noticed a similar behaviour but linked to the autocomplete property.
Setting autocomplete="off" prevents from having the cursor moving into or at the end of the mask.
It also prevents the user from inputing a value, which is an usability issue. A user enters the field with the cursor at the end with remaining room in the mask to enter content and tries to input a value, expecting something to show up in the field, but there is no response.
A user's likely expectation is:
- if they click on a blank field that their cursor is set to the start of the entry
- if they click on existing content the cursor is place at that location, provided that there is content that they are trying to edit in that location E.g. if the field has content like 122-363-3434 and they click after the 6 they would expect the cursor to show up there
- if they click on existing content that is partially filled, e.g. the mask is --**** and the current value is 112, and they click at the end of the field their expectation is that the cursor would be placed after 112
Bug is still there. As @nicolasnevraumont said, I had to set autocomplete="off" as a workaround.
Bug is still there. especially when you slide your mouse while mousedown over the field.
If an autocomplete will appear for the masked field when clicked it does not start at the beginning, likewise, if I have an autocomplete visible on another field and then click into the masked field it also does not start at the beginning.
Hi,
So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation and try the latest PrimeNG version(v19). If there is no improvement on this, can you open a new issue so we can include it in our roadmap?
Thanks a lot for your understanding! Best Regards,