question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onFocus and onBlur not called

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
choonkendingcommented, May 30, 2016

@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!

7reactions
loopmodecommented, Feb 14, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onblur event is not firing - javascript - Stack Overflow
To have Onblur on an element it should receive focus first, Div elements don't receive focus by default. You can add tabindex="0"
Read more >
My onblur and onfocus function is not working in javascript
Solution 1. Okay I check your problem, If you want to show onblur function and onfocus function then you have call proper ElementsTageName....
Read more >
Onfocus / onblur not working with RadzenDatePicker
In my application, I have created a control for receiving Scanner input, it pulls focus every 3 seconds. Outside of the control, when...
Read more >
React 17 internally uses the browser's focusin and focusout ...
In React, the onFocus event is called when the element receives focus and onBlur event is called when focus has left the element....
Read more >
calling this.blur() in onfocus handler or this.focus() in an onblur ...
The remaining problem that I noted (onblur=this.focus()) is probably caused by us not detecting that the blur handler did something. In the patch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found