Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulty editing masked input text fields before final hyphen #265

Open
luigi opened this issue Jun 11, 2021 · 4 comments
Open

Difficulty editing masked input text fields before final hyphen #265

luigi opened this issue Jun 11, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@luigi
Copy link
Contributor

luigi commented Jun 11, 2021

Kapture 2021-06-11 at 17 11 08

As shown above for our two masked input fields (phone number and SSN), when the user tries to edit the input in front of the final hyphen, unexpected behavior occurs. Deleting a digit pushes the cursor to the end of the input. Entering a new digit seems to work, but is jarring because the cursor once again gets pushed to the end of the input.

This unexpected behavior does not occur when editing digits after the final hyphen.

@luigi luigi added the bug Something isn't working label Jun 11, 2021
@cy-by
Copy link
Contributor

cy-by commented Jun 14, 2021

@luigi how urgent is this? Was it reported by clients?

@cy-by
Copy link
Contributor

cy-by commented Jun 14, 2021

Notes from today's investigation: in autoformatEventHandler, on every keystroke a new array is created and pushed into.

It has something to do adding the special character when deleting a value before a special character and the total length has already been filled out.

@luigi
Copy link
Contributor Author

luigi commented Jun 14, 2021

@coltborg Yes, clients have reported it.

@cy-by
Copy link
Contributor

cy-by commented Jun 17, 2021

Summary

@bengolder and I looked into fixing this masking issue and found some research on gov.uk that advised not to use masking at all.

Avoid input masking because it makes it harder for users to:

  • type a number in their preferred way
  • transcribe a number from another place and check that they’ve got it right

We're inclined to deprecate input masking because we trust gov.uk's research, but we want to confirm with design and research before we do it.

Short term recommendation

We advise to not use input masking by removing the .ssn-input or .phone-input class. Gov.uk's recommendations on telephone inputs can also help with how to present these fields.

How we tried to fix it

When trying to fix the JavaScript, we found that inserting special characters as a client types has negative effects when using screen reader, it would read out odd wordings of what was typed as the characters are inserted or when caret position changes. We also attempted to fix this bug by correcting the cursor position in JavaScript, but this further exacerbated the odd way that VoiceOver would read back the input value to the user.

An alternative could be that we keep the length consistent to the maxDigits, but that would mean we would have "blank" characters taking that space up, which would be read by screen readers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants