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

Press Enter key on AutoComplete submits the form #10861

Closed
1 task done
piuccio opened this issue Jun 10, 2018 · 4 comments
Closed
1 task done

Press Enter key on AutoComplete submits the form #10861

piuccio opened this issue Jun 10, 2018 · 4 comments
Assignees

Comments

@piuccio
Copy link

piuccio commented Jun 10, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.6.2

Environment

Any browser

Reproduction link

https://ant.design/components/form/#components-form-demo-register

Steps to reproduce

In the demo page there's a form with autocomplete (Website)

  1. Type anything in the autocomplete
  2. The dropdown opens
  3. Use keyboard up / down to highlight an option
  4. Press ENTER on the option

What is expected?

I expect the option to be selected but the form should not be submitted

What is actually happening?

The form is submitted, you can see that the form is submitted because all fields are now in red


Is there a way to prevent submit when the select dropdown is open?

@piuccio
Copy link
Author

piuccio commented Jun 10, 2018

Yes, enter on the field should submit, but not on the option.

To better understand please have a look at this simple form. The AutoComplete is the same as a Select (they share a lot of their code).

In the form above

  1. focus on the text field
  2. press tab to focus on the select
  3. press down to go to option two
  4. press enter to select option two

At this point, after one key press, the form is not submitted, but the option two is selected. If you want to submit the form you have to press enter again.

The AutoComplete behaves differently because on the first enter press submits the form

@afc163
Copy link
Member

afc163 commented Jun 10, 2018

Try reinstall node_modules

@piuccio
Copy link
Author

piuccio commented Jun 10, 2018

wow, thanks, very quick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants