-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Event for submitting single-field (onEnterKey
/onSubmit
perhaps?)
#35
Comments
I think it would be a good addition, although I would use the Alternatively we could just add an
|
I tried to think about how it might be used, and the action of "Submitting" an input, search box or whatever, usually can be triggered by both hitting "Enter" or clicking a button. Considering that, I was thinking about having a way to trigger |
I don't think it's unusual to submit an input from an icon which is displayed in an input, so we shouldn't add that, but if anybody wants to do that they can, by using the |
On that note, perhaps having a The trouble is actually making something like that work. This is one of the big issues I see with Mint's current state, the developer needs to manually keep track of every value and cross-reference stuff to do anything, and this is actually a reasonable problem to have, as there's no easy and obvious way to solve that. Still, being reasonable doesn't mean it's not annoying. Don't get me wrong though, it's a lot better than Elm and everything else that came before, but I believe it could still be improved in many ways, from having the |
I've been using Mint for a while, and in pretty much every project I ended up having to deal with the same problem. The most common scenario is when creating a Search Box. Seems pretty simple, create a
<Ui.Input >
, define astate
to hold its value (Shouldn't be needed but let's roll with it), define anonChange
event that updates the state, and now I have to submit it...onIconClick
makes for half of the solution, but a reasonable search box will also trigger when the user hits the Enter key, and that's not so easy in mint.Right now I'm using this slight aberration to make this work:
The
else
branch is irrelevant boilerplate, and thee.key == "Enter"
doesn't check for modifiers likeCtrl
orShift
or pretty much anything. It's be a lot easier to have something like:which could actually replace all three handlers above, with the added benefit of doing away with having a
state
.Am I the only one who thinks this is a good idea, or are there others who agree we could use something like this?
The text was updated successfully, but these errors were encountered: