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

Stop propagation enter #15

Open
Brzda opened this issue Jan 8, 2019 · 2 comments
Open

Stop propagation enter #15

Brzda opened this issue Jan 8, 2019 · 2 comments

Comments

@Brzda
Copy link

Brzda commented Jan 8, 2019

We used this input in forms, but when we pressed enter to add new email then form is submitted too.

@thomasJang
Copy link
Member

I fixed code.

  handleOnKeydown = (e: React.KeyboardEvent<HTMLInputElement>) => {
    switch (e.which) {
      case 13:
        e.preventDefault();
        break;
      case 8:
        if (!e.currentTarget.value) {
          this.removeEmail(this.state.emails.length - 1);
        }
        break;
      default:
    }
  };

Just released 0.4.4
Thanks for your contribution.

https://www.npmjs.com/package/react-multi-email

@Brzda
Copy link
Author

Brzda commented Jan 11, 2019

It works perfectly now, thanks for your time.

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

2 participants