-
-
Notifications
You must be signed in to change notification settings - Fork 782
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
Add shopping list items using the enter key #3118
Add shopping list items using the enter key #3118
Conversation
… field Related to: mealie-recipes#3114 * Enter key press is caught in note field in ShoppingListItemEditor * The create editor now stays open after saving a food item to a shopping list, to allow keyboard-only interaction with the shopping list
Related to: mealie-recipes#3114 An item is considered empty when the foodId is not set, and no note is set. This is only handled frontend, the backend still accepts empty items.
This looks good! A few notes after playing around with it a bit:
I'm okay with merging as-is, since it's still a good improvement, but I think getting a few other changes in will make the workflow much better |
Also, the latest merge fixes the food store bug you mentioned in discord, so it should be working as expected now |
Yeah, I have purposefully not touched the other fields as the keyboard can be used to navigate them, but I indeed do agree that they too are a bit clunky perhaps. For example, when the food dropdown/textfield is focussed, what is the expected behaviour of an enter key? How about the quantity? The dropdowns, combined with their search bar and then using the arrow keys and enter to select have never really worked nicely in any dropdowns throughout mealie for me, though. Instead, usually when I select a food item and press enter, the field is not actually set to that food item but the default one it selected, so perhaps that is another issue altogether to tackle instead of in this PR.
This I can definitely add to this PR, it seems more logical to me anyway to increase the speed of the shopping list fields.
Agreed, if we can discuss a set of expected behaviour around this specific component I'd be happy to implement it in this PR. |
I would expect the enter key to universally create the item, with the exception of when the dropdown is open (e.g. while typing a food). In that instance, I would expect the enter key to select the highlighted food (or the first one, if there is only one food).
Yeah I agree, if you're able to figure that one out it would be nice, but might be out of scope for this PR. I'm happy to be convinced otherwise on any of the above, I'm a backend guy mostly, but that's what my user-intuition is telling me. |
I went ahead and implemented a few of the things discussed above in #3178; Happy to get this merged, unless you wanted to take a look and handling the enter key on other fields first |
Ah sorry Michael. This slipped my mind. I can take a look tomorrow and move the enter event handler up a few levels until it works on the entire form. I’ll have to see to prevent it submitting in the case the dropdown is open. Otherwise I think an enter is always supposed to submit. I’ll add that to the PR tomorrow and let you know once it is updated. Should be a relatively easy fix too. |
Sorry, wasn't able to work on it Friday. Starting on it right now :) |
Signed-off-by: Jurriaan Den Toonder <[email protected]>
So, I did spend quite some time on this. However, I am not very used to Vue, not at all to be honest. If I want to handle enters in the dropdown I think it's better if someone with more Vue experience and experience in this code base would handle that |
Additionally, as the enter key opens and closes the dropdown, I think adding logic to the generic component may break how people use these dropdowns. I honestly think a first change would be improving how these dropdowns work in the entirety of mealie, and then think about how we would handle enter keypresses in fields like these. |
Makes sense to me, I had a feeling it wouldn't be an easy change, but I can dream. Thanks for taking a look anyway! Is this ready? I'll give it a final lookover |
This is ready, it has exactly the same functionality as in the gifs. It does not address the points you commented on initially. But I think you took care of one (or more) of them? But yeah, at least in the textarea field (the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for your work on this!
What type of PR is this?
What this PR does / why we need it:
Enter to save functionality:
Prevent empty items from being added:
Which issue(s) this PR fixes:
Related to: #3114