React-select: onFocus and onBlur not called

Created on 24 Nov 2015  路  5Comments  路  Source: JedWatson/react-select

NOTE: The issue was encountered in 1.0.0-beta5

When the <Select/> component is not searchable, neither onFocus nor onBlur are called when interacting with the component. I don't think it is the expected behaviour.

Most helpful comment

@IgorKirey Sometimes a repo maintainer could be busy with their own work and life. I know there might be a lot of issues that do not have a response (and I understand the frustration), but what we can do as a community is to try our best to provide support + try our best to give a hand in projects we care about. That's the power of Open Source right? :)


Issue related info
Have been encountering the same issue but only on IE Edge.

Browser: IE Edge (IE13)
OS: Windows 10
react-select version: beta-13

The onBlur event is working on Chrome and Safari, but not on Edge.

            <Select
                {...this.props}
                multi={true}
                searchable={false}
                clearable={true}
                autofocus={true}
                openAfterFocus={true}/>

I'm unsure what the root cause is, whether it is a React 15 problem or whether it's a react-select issue.

Any help would be appreciated!

All 5 comments

I agree with @ooflorent. I encountered this error.

I needed the onFocus et onBlur events on my <Select /> and the only fix I found was to add the searchable prop.

But I don't want my <Select /> to be searchable.

Seems it doesn't matter for author. So many questions without any response.

@IgorKirey Sometimes a repo maintainer could be busy with their own work and life. I know there might be a lot of issues that do not have a response (and I understand the frustration), but what we can do as a community is to try our best to provide support + try our best to give a hand in projects we care about. That's the power of Open Source right? :)


Issue related info
Have been encountering the same issue but only on IE Edge.

Browser: IE Edge (IE13)
OS: Windows 10
react-select version: beta-13

The onBlur event is working on Chrome and Safari, but not on Edge.

            <Select
                {...this.props}
                multi={true}
                searchable={false}
                clearable={true}
                autofocus={true}
                openAfterFocus={true}/>

I'm unsure what the root cause is, whether it is a React 15 problem or whether it's a react-select issue.

Any help would be appreciated!

This works just fine:

export default class Select extends PureComponent {
    static propTypes = {
        onFocus: PropTypes.func,
        onBlur: PropTypes.func,
    };
    render() {
        const {onFocus, onBlur, ...props} = this.props;
        return (
            <div onFocusCapture={onFocus} onBlurCapture={onBlur}>
                <ReactSelect {...props} />
            </div>
        );
    }
}

Simply use the capturing phase on a parent element. You handle the event on its "way down" before it even reaches ReactSelect.

I am having this issue in Chrome on v3, the above workaround does not work for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AchinthaReemal picture AchinthaReemal  路  3Comments

MindRave picture MindRave  路  3Comments

batusai513 picture batusai513  路  3Comments

x-yuri picture x-yuri  路  3Comments

jonorogers picture jonorogers  路  3Comments