Cannot submit form when enter key down
See original GitHub issuevue-autosuggest
version: 2.0.0node
version: 10.15.0npm
(oryarn
) version: 6.9.0
Relevant code or config
What you did: The form submit when [Enter] key down at input element on this component.
What happened: Key down event inhibite at this component key down event handler. Thus, the form submit was canceled.
Reproduction repository:
Problem description:
Suggested solution: If not affected, evaluate isOpen property in keydown event handler when captured at keycode 13.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Prevent users from submitting a form by hitting Enter
The keydown event is preferred over keyup as the keyup is too late to block form submit. Historically there was also the keypress...
Read more >Hitting enter not submitting my form! - Accessibility - SitePoint
Hi, when I hit enter on my site after hitting enter it's not submitting the form. Only clicking on login works.
Read more >How to disable form submit on enter button using jQuery
How to disable form submit on enter button using jQuery ?
Read more >The Enter Key should Submit Forms, Stop Suppressing it
One way to prevent this is to have the enter key do the submit ONLY when the button has the focus. Users with...
Read more >How to Stop the Enter Key From Submitting the Form - WPForms
To disable this key on your forms, which include the submit button, next/previous page buttons as well as using the enter key to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see your problem now. You can do this: If a user hits enter @selected is emitted, and if no item is passed in, then you can submit the form. I updated the example:
https://codesandbox.io/s/httpsgithubcomdarrenjenningsvue-autosuggestissues125-sn74o
Let me know if that helps.
You have to submit the form yourself, and this can be done in a number of ways:
But you probably want to also check to see if the user selected an item and not always submit the form.
https://codesandbox.io/s/httpsgithubcomdarrenjenningsvue-autosuggestissues125-sn74o