Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperform rejects dot as decimal mark on Firefox #68

Open
sbibauw opened this issue Jan 15, 2018 · 3 comments
Open

Hyperform rejects dot as decimal mark on Firefox #68

sbibauw opened this issue Jan 15, 2018 · 3 comments

Comments

@sbibauw
Copy link

sbibauw commented Jan 15, 2018

I am using Hyperform to validate a simple form including a decimal number field:

<input type="number" step="any">

On both Chrome and Safari (both last public releases), the browser and Hyperform accept both dot and comma as a decimal mark (valid examples: 0.99 and 0,99). But, strangely, on Firefox (57), it rejects the dot as decimal mark (0,99 is valid, but 0.99 is rejected).

I have tried specifying a regexp pattern, an explicit language code accepting both (lang="en-150"), but this behaviour stays the same. I do not understand why Hyperform would act differently on Firefox than on Chrome and Safari. And of course, if there is a workaround to allow both decimal marks to be accepted, that would be great!

@Boldewyn
Copy link
Contributor

Boldewyn commented Jan 18, 2018

That's indeed a problem with browsers, that do support type="number". Thanks for reporting!

The actual problem is, that the browser's UI is intercepting the user's input before it reaches the DOM. Hyperform never sees, what the user really put into that input. A similar scenario happens with type=email.

I have some preliminary ideas how to tackle that issue, but I need to evaluate them further before I can decide how to fix it. (Example: letting Hyperform changing type to text sounds like a quick fix, but then it has to keep track of what type every input really is, needs to overwrite access to input.type, etc.)

As an interim solution, I had luck with lang="en" (without the -150 specifier), but that might not extend to every combination of browser preferences and lang attributes in the markup.

@sbibauw
Copy link
Author

sbibauw commented Jan 18, 2018

Thanks a lot for your detailed response. I understand better now. It makes sense indeed the problem is with the browser. What was making me blame Hyperform is that the error message was from Hyperform, not from the browser.

@Boldewyn
Copy link
Contributor

Yes, that is actually the only thing that the browser let's trickle down to the DOM, that there was an error (specifically a “bad input error”).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants