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

Pressing enter key to select item submits form #196

Closed
eberkund opened this issue Sep 13, 2019 · 1 comment
Closed

Pressing enter key to select item submits form #196

eberkund opened this issue Sep 13, 2019 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@eberkund
Copy link

When I press the enter key to select an item the form gets submitted, this differs from the behaviour of the built in browser select. Is there a way to change this behaviour? Maybe block this event from getting through somehow.

Thanks, great component!

@iliyaZelenko
Copy link
Owner

iliyaZelenko commented Sep 13, 2019

@eberkund Thanks for using the component.

You can solve the problem using @keydown.enter.native.prevent (huge chain!):

<form>
  <cool-select
    v-model="selected"
    :items="items"
    placeholder="Select name"
    @keydown.enter.native.prevent
  />
</form>

I checked it works.

In my component, I think I need to save the submit event, but so that it only works when the menu is closed.

@iliyaZelenko iliyaZelenko added enhancement New feature or request question Further information is requested labels Sep 13, 2019
iliyaZelenko added a commit that referenced this issue Sep 13, 2019
iliyaZelenko added a commit that referenced this issue Sep 13, 2019
iliyaZelenko pushed a commit that referenced this issue Sep 13, 2019
## [2.11.1](v2.11.0...v2.11.1) (2019-09-13)

### Bug Fixes

* **input:** do not submit the form if there was a menu choice (if the component is inside the form) ([50bc64d](50bc64d)), closes [#196](#196)
rin4573281133639 added a commit to rin4573281133639/iliyaZelenko9 that referenced this issue Feb 5, 2022
## [2.11.1](iliyaZelenko/vue-cool-select@v2.11.0...v2.11.1) (2019-09-13)

### Bug Fixes

* **input:** do not submit the form if there was a menu choice (if the component is inside the form) ([50bc64d](iliyaZelenko/vue-cool-select@50bc64d)), closes [#196](iliyaZelenko/vue-cool-select#196)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants