In onMenuClose or onBlur event of react-select identify whether event is triggered by option selection or the blur - reactjs

In react select onBlur event or onMenuClose event is triggered when user selects the option or blur (click outside of the control).
So I want to perform the business logic on blur event if user has not selected an option.
In other words I want to know how blur event is triggered.

onBlur event is triggered when the focusable HTML Element loses focus. Maybe it's easiest to see if select option was changed? Don't know how your implementation looks though but maybe this will help you.

Related

Primeng dropdown firing onBlur event

I need to fire onBlur event for p-dropdown. I need this to be fired only when the dropdown looses focus. But its firing onBlur event even when I click on dropdown. I know there is 'onSelect' event but I cant use that.
My requirement is, User can either select a dropdown value or can enter any text which is not in dropdown. I need to save the info into DB.
I tried putting a settime but its not working out.

how to stop blur event on calling reset of textfield

It appears that on calling reset event of textfield in ExtJS 4.2 the blur event is automatically called.
i have a scenario where in a form i have combo box and textfield, on select of combo box i am calling reset of textfield.
#cmbStatus : {
select : function(combo, records, eOpts){
combo.up('form').down('textfield[name=referencenumber]').reset();
}
and on blur of textfield i am calling reset of combo box.
#txtRefNumber : {
blur : function(cmp, The, eOpts){
cmp.up('form').down('combobox').reset();
}
}
here, because of the cascading effect on select of combo box, since reset is being called, the textfield blur event is automatically called and combo box reset event occurs
Is there any way i can stop the textfield blur event ?
I am aware about the suspendEvent method of textfield but no use as it will suspend the event till resumeEvent is called.
Thanks
The blur event is not fired as a direct result of calling reset but as a response to moving focus out of the text field.
You will probably need to reconsider and redesign the logic so that the event loop does not occur. Try to use a different event, for example change.
Also, calling suspendEvents might be necessary to avoid the event loop, depending on the logic you need.

AngularJS analogue to jQuery preventDefault for keydown?

I need the browser to respond to keydown arrow events in focused scrollable boxes.
Here is a Plunker to show what I mean
http://plnkr.co/edit/Okch5dEByFkueJl0DmwG
Even if I tell the event to stop propagating with event.stopPropagation()
and make the event handler return false the box keeps scrolling on keydown.
Unless I'm mistaken as far as what you're looking for, you should just be able to change your
event.stopPropagation()
back to
event.preventDefault()
and it will work as desired.

TabControl TabIndexChanged won't fire

The TabIndexChanged event of the Windows Forms TabControl doesn't fire when I change between tabs. But the SelectedIndexChanged event is fired.
What is the explanation for this?
The TabIndexChanged event fires when you change the TabIndex property of the control-- the order of controls related to the parent form, etc. It has nothing to do with when the user is switching tabs.
Besides the SelectedIndexChanged event, you probably want to explore the Selected, Selecting, Deselected, and Deselecting events to determine what to do when the user is changing tabs.

ContactUp event not fired

In my surface application I have a SurfaceWindow with a SurfaceUserControl on. On the SurfaceUserControl I have a SurfaceButton but the ContactUp (and down) event is not fired. The ContactHoldGesture event is fired though.
Any ideas?
Could you include some code to reproduce? Where are you subscribing to those events?
Most likely what's happening is the contact up and down events are being handled by the button, so they don't fire at the usercontrol level. Try looking at the previewcontactup and previewcontactdown events.
ContactUp and ContactDown are handled by the button itself - that's why the events never get to your code. If you really want to intercept these events, use PreviewContactUp/PreviewContactDown instead. What you probably really need though is to just handle the Click event on the button. Adjust the ClickMode property of the button if you want to change what causes the Click event to be raised.

Resources