Prevent submitting parent forms when closing a modal
A weird issue noticed while working on #244 (closed): clicking the OK or close buttons inside of a Modal causes the modal to close, but also triggers submit
events on all parent <form>
elements.
This is a general issue with <button>
tags: the type
attribute is optional and defaults to type="submit"
, which is something we rarely want by default in a SPA. The React ESLint plugins includes a button-has-type rule, but I couldn't find one for Vue or for general JavaScript.
There are around 50 other cases of buttons without types in the frontend which could cause later issues with unexpected form validations.
Edited by Erwan Rouchet