Fix(client): Fix Unintentional Form Submission on Rich-input Toolbar Actions #1997
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request addresses a bug where the "Insert Image" button and certain toolbar actions (Insert Horizontal Rule and Insert Break Line) would unintentionally trigger the submission of section_dialog
Fixed Problem
Changes Made
Prevent Default Form Submission for Insert Image
Updated the InsertImageForm component to use e.stopPropagation() and e.preventDefault() in the onSubmit handler. This prevents the image insertion from causing the parent form to submit.
Set type="button" for Toolbar Buttons:
Ensured the "Insert Horizontal Rule" and "Insert Break Line" buttons in the toolbar have type="button" to prevent them from submitting the parent form.
Testing
Related Issues
Fixes #1996
This is my first contribution to an open-source project. Please let me know if there are any issues or areas for improvement. Thank you!