0

For a small, mobile first (web)application, I'm trying to create a pin / password input (mask), something like:

+---+ +---+ +---+ +---+
| 1 | | 2 | | 3 | | 4 |
+---+ +---+ +---+ +---+

During the implementation of various solutions, the user experience became either unpredictable or confusing, which I hope I can overcome... The options below list the findings I came across, demo: implementation of the three solutions (simplified)

Multiple inputs

  • Unable to detect backspace (during keydown / keyup) on mobile; this makes navigating to the previous input field, when backspace is pressed and the field is empty, hard to implement.
  • Unable to use the 'double tap shift' functionality on the soft-keyboard; focusing (by user action / scripting) to the next input gives a 'jumping' keyboard (either way in combination with 'double tap shift' autocapitalize on or off)

Letter-spacing combined with a background repeating-linear-gradient (both calculated)

  • Letter-spacing is somewhat different implemented than one might expect, characters always end with 'letter-spacing', instead of having space between the characters. This causes a horizontal scroll to occur when the 'end' of the input field has been reached
  • Removing a character, shifts the whole string, instead of 'emptying' the removed character

Word-spacing (appending a space after each character) with a background repeating-linear-gradient (both calculated)

  • Removing a character, shifts the whole string, instead of 'emptying' the removed character

So the question is somewhat twofold; first, I may have missed another solution(?) Second, for the solutions mentioned the findings listed can be can be 'countered'(?)

Dalie
  • 626
  • 1
  • 7
  • 19
  • Give us some code to work with so we don't do the exact same thing you did only to find out it doesn't work. Would much rather work from something. – Waxi Mar 06 '17 at 19:23
  • @AmericanSlime, code / demo has been added. – Dalie Mar 06 '17 at 21:06

1 Answers1

0

Use JQuery Hotkeys for your input detection:

https://github.com/jeresig/jquery.hotkeys

Honestly JQuery and it's modules seem to solve most of your problems.

I think you could also benefit from this answer: CSS: Create iOS style Pin Password box

Community
  • 1
  • 1
Matt O.
  • 277
  • 2
  • 8