57 points · by padseeker · 4y ago · 76 comments
Do not ever use the number input type, for any purpose.
If you have a number element on your form, people will accidentally mangle their own inputs, because the value in such an element silently changes when you use the mouse wheel.
Yeah this can happen if you're dispatching scroll events to all descendants. but typically it is not an issue if you haven't messed with how the browser scrolls with JS.
What platforms does this happen to your users on?
My anecdote is that I've used numeric fields in all sorts of situations and have never ran into this outside of scroll-hijacked sites. I tend to respect the browser's implementation of the input types and find that they're fully functional - especially in 2022.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/In...
> Avoid using inputs with a type of number > Do not use <input type="number"> unless your user research shows that there’s a need for it. With <input type="number"> there’s a risk of users accidentally incrementing a number when they’re trying to do something else - for example, scroll up or down the page. And if the user tries to enter something that’s not a number, there’s no explicit feedback about what they’re doing wrong.
(https://design-system.service.gov.uk/components/text-input/#...)
https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-des...
How will you handle users who have javascript disabled?
Why reinvent the wheel? Why not fix whatever problem you have with numeric input?
They won't/can't. Their only real options are to fallback to either the "text" field or the "numeric" field.
> Why reinvent the wheel? Why not fix whatever problem you have with numeric input?
JS devs will prioritize chasing after their ideal UIX long before they consider things like JS being disabled, screen readers, ARIA tags, cross-platform compatibility, etc.
There's countless replacements for long-supported HTML input fields that still get active development: date pickers, numeric inputs, sliders, you name it. If it exists in the base W3C spec someone has likely reinvented the wheel for every purpose from pixel-perfect skeuomorphism, to aggressive input masking, to "instant feedback," to vaguely claiming "you cannot trust the number input" - the list goes on and on.
---
OP if you're reading this - I hope you're considering JS being disabled (graceful + functional fallbacks), ARIA, aggressive cross-platform testing, and testing with real screen readers. If you aren't, this is not an accessible service.
Think a currency input, or SSN, or zip code field. You almost never actually want the functionality of an html number input.
Admittedly keenforms isn't for EVERYONE. There are built from scratch forms that use React or Angular or Javascript that provides instant feedback. Its not impossible to forgo JS but its hard to create a better UX with the instant feedback that only javascript can provide.
My online banking uses this bullshit. I was trying to navigate, hit an arrow key, and noticed that the monetary value I was entering changed.
All jokes aside (given that I suck as a web-dev and still resort to plain vanilla html/css/js to build front ends for my webapps) what would have been great to see in your post was a list of problems with the 200 form builders - or atleast top N common anti-patterns amongst those and your understanding of how they came be and your philosophy and solution for tackling those. The demos definitely help but I couldnt help but feel this was more of a whackamole?
I could probably write a detailed article for each particular feature. That would take some time. Thanks for the feedback and comment.
The haters are fine. I'll take constructive criticism, as well as accept negative attention. All press is good press right?
I don’t know what the opposite of “Not Invented Here Syndrome” is. But these days I swear all anyone wants to do is MacGyver together three dozens layers and frameworks and pray the spit holds it together.
If you know what you want, and no tools does it, then just roll your own. Inventing Things Here is criminally underrated.
Right now it does not have a date picker because the difficult of writing a rules engine that handles date conditions. I hope to change that down the road, this is more than an MVP but I have so much more I hope to do.
Does it mean custom HTML written by the creator of the form or just a few precanned options?
You can even append to an HTML value so you can use multiple rules to build up HTML content.
The perfect abstract does not exist and one that can do everything is the one that doesn’t have the abstraction to begin with. I.E. use the underlying API directly
There will always be something that will be beyond reach for SaaS, a level of customization beyond scope of my app. This just goes a few steps further.
Wait... What?
Is that a name that people use in a non-sarcastic way?
Given the logical absurd built on the name of the thing, I really don't think this is a goal that will bring good results. It will not generalize at all. (What is also evidenced by the fact that there are more than 200 of those around, and none solves the very common problem the author has.)
And yes, that comes from framing the solution along that phrase.