alsoscotland / react-super-select

MIT License
95 stars 33 forks source link

onBlur event? #155

Closed dave-irvine closed 6 years ago

dave-irvine commented 6 years ago

Hi!

Currently, when you open the super-select, it fires the onBlur event because the dropdownContent is rendered as a sibling to the triggerDiv, and opening the select causes focus to jump to the dropdownContent.

Is this the right place for the onBlur handler to go? At the moment I'm having to intercept the onBlur, detect where the focus has jumped to, and if the focus is on dropdownContent then ignore the blur event. I then have to use the onCloseDropdown handler to detect when a 'blur' is really happening.

Would it be possible to only issue the blur event when the control is truly blurred? i.e when focus has left the container, not just the trigger.

alsoscotland commented 6 years ago

@dave-irvine It is possible I could move the onBlur handler to the outermost div in the control but I am not 100% sure that would not have undesirable consequences. I will have to give it a try. A bit swamped at the moment though. May be able to take a look in a few days