Material: <input type="number" ... /> allows not-numeric characters on Safari browser

Created on 19 May 2016  路  5Comments  路  Source: angular/material

On safari browser it is possible to write letters inside when its marked as type="number". Can be tested at official ng-material page at input section - "Donation amount" at the bottom of the page https://material.angularjs.org/latest/demo/input

image

Most helpful comment

It might be because of the exponential notation in JS (e.g. 1.00001e+32).

All 5 comments

Material doesn't do any number validations/limitations on the user input. I believe only Angular marks it as invalid.

@crisbeto I agree. Also on every browser, you can type e in the number input.

This seems to be intentionally, but I haven't figured the why yet.

It might be because of the exponential notation in JS (e.g. 1.00001e+32).

@crisbeto its not only because of JS, its because of global use in math :)

@crisbeto @DevVersion ok, actually it is a browser-level problem. Safari handles type="number" differently and allows to write also other characters instead of numbers only. To block it you have to write custom event handler.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robertmesserle picture robertmesserle  路  3Comments

bobber205 picture bobber205  路  3Comments

nikhildev picture nikhildev  路  3Comments

WebTechnolog picture WebTechnolog  路  3Comments

PeerInfinity picture PeerInfinity  路  3Comments