I have a form which performs an event on submit.
The form contains a textarea, that when you click on it, the submit button appears, and when you click out it disappears (using onFocus and onBlur for this to flag variable 'showSubmit'):
<form id="commentsForm" onSubmit={handleSubmitForm}>
...
<textarea
onFocus={onFocusShowSubmit}
onBlur={onBlurHideSubmit}
id="comment" name="comment" type="text" required></textarea>
{showSubmit
?
<button type="submit">Post Comment</button>
: null}
</form>
The onBlur event is blocking the button to be clicked and therefore to submit the form.
I read about using onMouseDown event in the button, and it does work, but it does not capture the form event. And I really need to pass the form event to the "handleSubmitForm" to be able to retrieve the form data..
Does anybody know how I could work this out? Thanks!