angular / material

Material design for AngularJS
https://material.angularjs.org/
MIT License
16.55k stars 3.39k forks source link

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

Closed lukKowalski closed 8 years ago

lukKowalski commented 8 years ago

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

crisbeto commented 8 years ago

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

devversion commented 8 years ago

@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.

crisbeto commented 8 years ago

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

lukKowalski commented 8 years ago

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

lukKowalski commented 8 years ago

@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.