Components: input type number allow any character in Firefox

Created on 2 Jun 2017  路  6Comments  路  Source: angular/components

Bug

What is the expected behavior?

With input type number I should see characters like 'aaa'

What is the current behavior?

I can type any cahracter

What are the steps to reproduce?

https://plnkr.co/edit/Fn3W5yPofeNFtXZCynpW?p=preview

Type 'aa' for example

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material beta-6
Angular 4.1.3
FireFox 53.0.3

Is there anything else we should know?

Most helpful comment

when the type="number" for input, it is enough information to force it to take numeric inputs. And it works perfectly in Chrome. Why do we have to make additional check (checkIfNumber) and do our own validation for firefox? It clearly does not work for firefox and it is a bug and should be registered as a bug and not be closed.

All 6 comments

Any character can be typed into the input field in Firefox due to the implementation choice within Firefox. Firefox allows the entry of the non-number characters but notes it as invalid within the form.

You should be able to prevent the input of non-number characters by listening to events on the input. <input type="number" (keypress)="checkIfNumber($event)">

What he said does not work on mobile devices. That is really awful !!

when the type="number" for input, it is enough information to force it to take numeric inputs. And it works perfectly in Chrome. Why do we have to make additional check (checkIfNumber) and do our own validation for firefox? It clearly does not work for firefox and it is a bug and should be registered as a bug and not be closed.

Hello
Any update on this bug

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dzrust picture dzrust  路  3Comments

jelbourn picture jelbourn  路  3Comments

Miiekeee picture Miiekeee  路  3Comments

constantinlucian picture constantinlucian  路  3Comments

vanor89 picture vanor89  路  3Comments