The previous implementation of the auto save in #253 did not account for firefox's interpretation of preventDefault which always shows the warning message when navigating away, as opposed to only when errors were present. That presented issues with getting the page to wait for the form submission as well as a firefox's way of using fetch.
This fix uses navigator.sendBeacon to submit the form, ensuring that the page does wait, and that it is successfully submitted.
Connects #221
Testing Instructions
Navigate to a project detail page on Firefox
Edit some fields correctly and navigate away from the page
Return to the page to confirm that the new values have been saved
Edit some fields incorrectly and navigate away from the page
Confirm that a warning about unsaved changes appears, and upon clicking cancel, form errors are displayed as if you had clicked the Save Project button
Overview
The previous implementation of the auto save in #253 did not account for firefox's interpretation of
preventDefault
which always shows the warning message when navigating away, as opposed to only when errors were present. That presented issues with getting the page to wait for the form submission as well as a firefox's way of usingfetch
.This fix uses
navigator.sendBeacon
to submit the form, ensuring that the page does wait, and that it is successfully submitted.Connects #221
Testing Instructions