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

Enter submits form in Firefox #462

Closed
drweissbrot opened this issue Nov 12, 2018 · 4 comments
Closed

Enter submits form in Firefox #462

drweissbrot opened this issue Nov 12, 2018 · 4 comments

Comments

@drweissbrot
Copy link

I'm using a multiselect instance of Choices, within a <form>. When I select a choice by pressing Enter, Firefox will automatically try and submit the form.

An example in a Codepen: https://codepen.io/drweissbrot/full/QJGqGj/

The console mentions ReferenceError: event is not defined in https://github.com/jshjohnson/Choices/blob/master/src/scripts/choices.js#L1258.

Everything is working properly when clicking to select a choice.

This appears to only be a problem in Firefox, everything is working fine in Chrome. I'm using Choices 4.1.1 beta, the problem also persists in 4.1.0.

@atomgiant
Copy link

I am seeing the same thing. As a temporary work around I'm using this jQuery to disable all form submit with Enter

    $(document).on("keypress", ":input:not(textarea)", function(event) {
      return event.keyCode != 13;
    });

@drweissbrot
Copy link
Author

Thanks! Had to make some changes since I don't use jQuery, but it seems to work.
Obviously not a permanent solution though :/

@jshjohnson
Copy link
Collaborator

Yeah this is a bug - will investigate 👍

@jshjohnson
Copy link
Collaborator

This has been resolved in version 4.1.2. Thanks 👍

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