Closed Bug 864703 Opened 11 years ago Closed 11 years ago

Invalid number input causes pin entry buckets to be emptied

Categories

(Marketplace Graveyard :: Payments/Refunds, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2013-05-16

People

(Reporter: scolville, Assigned: scolville)

References

Details

(Whiteboard: p=2)

If you enter a number such as 1.. on B2G and webkit because the input is invalid the value of the input becomes an empty string.

This causes the visible pin entry to look like it's starting over because the whilst the input still contains text the length of the input value determined via JS is 0.

The workaround is probably going to require displaying the entire pin entry as invalid as early as possible and possibly detecting the invalid input state without looking the value of the input.
Assignee: nobody → scolville
Whiteboard: p=1
We need input type="number" to get the keyboard however there's a few problems to work around - specifically as it stands there doesn't seem to be any way possible to discern an invalid input on b2G.

I was able to use input.validity.valid on webkit. However unfortunately this doesn't work on up to date re-flashed unagi. 

Any input that starts with "." is:

 * Not seen as invalid (input.validity.valid) is true
 * The input value becomes "" 
 * input.validity.patternMismatch is false.

A test case is here: http://jsbin.com/eyuqul/3

Looking into this further I found this bug which looks to be relevant [1] as it relates to using a special attr to restrict the keyboard to numeric entry only which will solve the problem in the future when this is available.

I'll look to file a platform bug for the fact that number input validation with patterns doesn't seem to work correctly.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=820268
Depends on: 868436
Test case without any JQuery http://jsbin.com/eyuqul/7
> I'll look to file a platform bug for the fact that number input validation
> with patterns doesn't seem to work correctly.
> 

Filed https://bugzilla.mozilla.org/show_bug.cgi?id=868436
(In reply to Stuart Colville [:scolville] from comment #3)
> > I'll look to file a platform bug for the fact that number input validation
> > with patterns doesn't seem to work correctly.
> > 
> 
> Filed https://bugzilla.mozilla.org/show_bug.cgi?id=868436

You'll need to wait for bug 344616 for input[type=number] to land in Firefox. Supported in every other browser, including IE 10.
(In reply to Chris Van Wiemeersch [:cvan] from comment #4)
> (In reply to Stuart Colville [:scolville] from comment #3)
> > > I'll look to file a platform bug for the fact that number input validation
> > > with patterns doesn't seem to work correctly.
> > > 
> > 
> > Filed https://bugzilla.mozilla.org/show_bug.cgi?id=868436
> 
> You'll need to wait for bug 344616 for input[type=number] to land in
> Firefox. Supported in every other browser, including IE 10.

Interesting I didn't know of that bug - however the pattern attr should still work on b2g shouldn't it? (it does on desktop ff)
(In reply to Stuart Colville [:scolville] from comment #5)
> (In reply to Chris Van Wiemeersch [:cvan] from comment #4)
> > (In reply to Stuart Colville [:scolville] from comment #3)
> > > > I'll look to file a platform bug for the fact that number input validation
> > > > with patterns doesn't seem to work correctly.
> > > > 
> > > 
> > > Filed https://bugzilla.mozilla.org/show_bug.cgi?id=868436
> > 
> > You'll need to wait for bug 344616 for input[type=number] to land in
> > Firefox. Supported in every other browser, including IE 10.
> 
> Interesting I didn't know of that bug - however the pattern attr should
> still work on b2g shouldn't it? (it does on desktop ff)

So the update is according to the spec, pattern attrs shouldn't be used with number inputs.

A workaround will be up for review shortly.
Status: NEW → ASSIGNED
Whiteboard: p=1 → p=2
> A workaround will be up for review shortly.

Will push when github is back up, it's been down for the last hour.
https://github.com/mozilla/webpay/commit/957d368479277afdd88a983da061ce8057e0a421
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2013-05-16
You need to log in before you can comment on or make changes to this bug.