I have two elements:
The solution is so simple - you just need to use the mousedown event instead of the click event.
The order of the events is:
mousedown - of the div element which you wanted to use in its click event
blur - of the other element, that your logic is inside.
click - of the div element
You can save a flag in the mousedown event and then, in the onBlur logic, check the flag to know if need to call the click function manually
submitDown() {
saveCalled = true;
}
do(){
....
if(saveCalled){
saveCalled = false;
save();
}
}