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

[FR] Pressing Enter key in input fields of forms regardless of input type should execute the Submit action #7014

Closed
1 of 2 tasks
shapirus opened this issue Apr 12, 2024 · 9 comments · Fixed by #8129
Closed
1 of 2 tasks
Labels
enhancement This is an suggested enhancement or new feature help wanted Assistance required old user interface Issues with Old User interface Platform UI Related to the React based User Interface question This is a question starter Good issue for a developer new to the project
Milestone

Comments

@shapirus
Copy link

shapirus commented Apr 12, 2024

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find a similar feature request

Problem statement

I'm not really sure if it is to be treated as a bug or a feature request. When I edit a part's parameter where the input type is string (that can be typed), then pressing Enter when that input field has focus submits the form.

If, however, the field is a drop-down list with predefined choices, then pressing Enter when that field is focused has no effect (at least in Firefox).

It would be nice if the Enter key worked to submit the form in that case as well (without having to reach for the mouse and aim for that Submit button), as that's a standard and normally expected UI behavior.

parameter

parameter1

Suggested solution

Will probably need a dedicated JS handler to get it done, not sure what modern frontend tech has to offer.

Describe alternatives you've considered

n/a

Examples of other systems

No response

Do you want to develop this?

  • I want to develop this.
@shapirus shapirus added enhancement This is an suggested enhancement or new feature triage:not-checked Item was not checked by the core team labels Apr 12, 2024
@SchrodingersGat
Copy link
Member

Any changes to the forms / frontend (unless to address critical bugs) will only be applied to the new react interface

Please checkout the new interface at https://demo.inventree.org/platform to see if the new forms interface has the same "issue"

@SchrodingersGat SchrodingersGat added question This is a question old user interface Issues with Old User interface Platform UI Related to the React based User Interface and removed triage:not-checked Item was not checked by the core team labels Apr 13, 2024
@shapirus
Copy link
Author

Please checkout the new interface at https://demo.inventree.org/platform to see if the new forms interface has the same "issue"

It is actually worse there: pressing the Enter key in the Data input field has no effect regardless of whether the value is a scalar or a choice type, and the user is forced to reach for the mouse or use touchpad to click the Sumbit button.

@SchrodingersGat
Copy link
Member

Ok, I think we should change the scope of this issue to just the new interface then. Do you mind editing the title of this issue appropriately?

@shapirus shapirus changed the title [FR] The "Edit Parameter" form should be submitted on pressing Enter when Data input is a drop-down list choice [FR] Forms, e.g. "Edit Parameter", should be submitted on pressing Enter key when any of the inputs has focus Apr 14, 2024
@shapirus shapirus changed the title [FR] Forms, e.g. "Edit Parameter", should be submitted on pressing Enter key when any of the inputs has focus [FR] Pressing Enter key in input fields of forms should execute the Sumbit action Apr 14, 2024
@shapirus shapirus changed the title [FR] Pressing Enter key in input fields of forms should execute the Sumbit action [FR] Pressing Enter key in input fields of forms regardless of input type should execute the Sumbit action Apr 14, 2024
@shapirus
Copy link
Author

Do you mind editing the title of this issue appropriately?

done!

Copy link
Contributor

This issue seems stale. Please react to show this is still important.

@github-actions github-actions bot added the inactive Indicates lack of activity label Jun 14, 2024
@shapirus
Copy link
Author

This issue seems stale. Please react to show this is still important.

...still important, for whenever it can be implemented.

@SchrodingersGat SchrodingersGat removed the inactive Indicates lack of activity label Jun 14, 2024
@SchrodingersGat SchrodingersGat added this to the horizon milestone Jun 14, 2024
@SchrodingersGat SchrodingersGat added help wanted Assistance required starter Good issue for a developer new to the project labels Jun 14, 2024
@timmyhadwen
Copy link
Contributor

timmyhadwen commented Sep 15, 2024

@SchrodingersGat Looking at doing this at the moment. From what I can see if will be difficult to implement a "modal wide" Enter keydown event -> submit flow. If you can think of an easy way to achieve this let me know and I can look into it.

Failing that, is this going to require a keyDown event handler in each form field type, which calls back through (a few layers) to the form and runs form.submitForm?

PS: Also the first time Im opening this code base so apologies if I'm just not seeing the easy way to achieve this.

@shapirus shapirus changed the title [FR] Pressing Enter key in input fields of forms regardless of input type should execute the Sumbit action [FR] Pressing Enter key in input fields of forms regardless of input type should execute the Submit action Sep 15, 2024
timmyhadwen pushed a commit to timmyhadwen/InvenTree that referenced this issue Sep 15, 2024
@timmyhadwen
Copy link
Contributor

My attempt committed above, my react is rusty. Thoughts and comments welcome.

@SchrodingersGat
Copy link
Member

@timmyhadwen thanks for tackling this. I'd suggest that you open a pull request against your branch, so we can review there

SchrodingersGat pushed a commit that referenced this issue Sep 26, 2024
* Potential fix for #7014. Might be wrong way to approach

* Cleanup null check on onKeyDown callback

* revert pre-commit change

---------

Co-authored-by: timmyhadwen <[email protected]>
Co-authored-by: Matthias Mair <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an suggested enhancement or new feature help wanted Assistance required old user interface Issues with Old User interface Platform UI Related to the React based User Interface question This is a question starter Good issue for a developer new to the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants