question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not select-able with 'enter' key in a form tag

See original GitHub issue

I have a <form> tag with vue-select in it and the item is not select-able when I press ‘enter’ (mouse select works fine).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
nicolasigotcommented, May 12, 2019

I was just able to prevent it by adding: @keypress.enter.native.prevent=“” to the v-select element.

3reactions
bformetcommented, May 21, 2017

I confirm issue that pressing enter in v-select submits the form.

My code:

<form @submit.prevent="submitForm">
    <input v-model="name" type="text" required>
    <v-select :options="countries" v-model="country"></v-select>
    <button type="submit">Submit</button>
</form>

Is there a workaround?

I cannot do the following because I’d loose the validation of required fields. <button type="button" @click="submitForm">Submit</button>

I suppose enter key event is bubbling too far. Any idea how to solde this?

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

my enter key is not working for form? - Stack Overflow
As per my recent question, the only way to process a form by pressing enter is to have 1) a sumbit button or...
Read more >
<input>: The Input (Form Input) element - HTML
If this attribute is not specified, the default type adopted is text . The available types are as follows: Type, Description, Basic Examples ......
Read more >
Forms in HTML documents - W3C
Control types created with INPUT; Examples of forms containing INPUT controls. The BUTTON element; The SELECT , OPTGROUP , and OPTION elements.
Read more >
Javascript Disable on Enter key not working? - MSDN
I use javascript and it does work, the enter key stops working. UNLESS the mouse cursor is in the password textbox, then hitting...
Read more >
Enter key submitting form when menu open but showing no ...
your proposed solution does prevent form submit when hitting enter with no options to choose from, but it also prevents selecting an option...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found