React-select: Enter event

Created on 14 Dec 2017  路  4Comments  路  Source: JedWatson/react-select

Hi, good work!

I think the problem comes with #212...

Every input item on a form, if its focused, it will submit the form (if not empty!) if you press enter key... but react-select will open the list... why? I don't see any good reason for that...

Anyway, if this will be the behaviour, how can I solve it?

thanks

Most helpful comment

@thiagolelis-luizalabs thanks but wasnt this issue fixed and is supposed to be intended functionality, not supposed to be overwritten?

All 4 comments

Same issue here

Having the same problem

You can override the onInputKeyDown function, like this:

    onInputKeyDown(event) {
        switch (event.keyCode) {
            case 13: // ENTER
                event.preventDefault();
                break;
        }
    }

And on Select

<Select
    {...otherProps}
    onInputKeyDown={onInputKeyDown}
/>

@thiagolelis-luizalabs thanks but wasnt this issue fixed and is supposed to be intended functionality, not supposed to be overwritten?

Was this page helpful?
0 / 5 - 0 ratings