Skip to content

Unexpected behaviour on Input element onKeyPress event #1920

@marcbelmont

Description

@marcbelmont

Here's the element I have:

React.DOM.input({onKeyPress: this.onKeyPress});

onKeyPress: function(event) {
if (event.keyCode === 13) // Enter key
event.preventDefault();
}

With react 0.10, preventDefault was working. On 0.11, with the focus on the input, pressing enter does a form submit and reloads the page.

I've also tried doing the preventDefault on the onKeyDown event with no luck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions