hauleth / vanilla-ujs

UJS without jQuery dependency
MIT License
194 stars 24 forks source link

Handle disabling edge cases #27

Closed j10k closed 7 years ago

j10k commented 7 years ago

Currently, right-clicking a link will disable it even though right clicks typically do not trigger any action.

Forms can have integrated validations (i.e. fields need to be filled or conform to a pattern). Attempting to submit a form with invalid input elements will show a browser message asking to amend the error rather than submit the form. However, we currently disable the submit button regardless of such validations. This effectively locks the user from the page, since she cannot submit the form even after fixing the error.

This commit addresses both of these issues: Only left and middle clicks properly disable the link, and submit buttons only disable if the form is valid and has hence been submitted.

hauleth commented 7 years ago

LGTM