analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Massive bug with `handleTaggedFormSubmitEvent` submitting a prevented form

Open shahyar opened this issue 4 months ago • 1 comments

Past Issues Searched

  • [X] I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • [X] This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

When you assign plausible-event-name to a <form>, the Plausible JS will RE-SUBMIT THE FORM. This behavior is completely undocumented.

This will cause a controlled form (ie. in a React app) to be re-submitted, even if I didn't want it to be submitted.

I'm honestly shocked somebody thought this was a good idea.

Expected behavior

First, the handler should check event.defaultPrevented BEFORE attempting to defaultPrevent itself and then re-submit.

Second, the documentation should show a massive red warning with why you should not use this on a controlled <form>.

Screenshots

No response

Environment

- OS: all
- Browser: all
- Browser Version: all

Likely affects Plausible Cloud.

shahyar avatar Oct 16 '24 19:10 shahyar