two-brothers / overcooked-cms

0 stars 0 forks source link

`RecipeRecord` submit button should have type 'submit' #9

Closed nikeshnazareth closed 5 years ago

nikeshnazareth commented 5 years ago

The RecipeRecord component submit button currently does not have the type 'submit'. This means that it does not provide meaningful error messages when some of the components are invalid.

The reason for this situation is when type={'submit'}, changing a step in the method causes the entire form to be checked for validation errors. If the form is invalid, a message is displayed to the user and the focus is moved to the first invalid control.

I don't know why that happens.

Some diagnostic info:

This issue might be obsolete by issue #2

nikeshnazareth commented 5 years ago

I found the issue. Pressing Enter anywhere on the form attempts to submit it.

I was using Enter to add each step in the recipe. The solution is simply to call event.preventDefault() whenever I want to respond to Enter events without submitting the form