Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(client): Fix Unintentional Form Submission on Rich-input Toolbar Actions #1997

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

2368883029
Copy link

@2368883029 2368883029 commented Jul 21, 2024

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

  • Issue: The "Insert Image" button would unintentionally cause the section_dialog to submit, closing the form. (issue [Bug] Can't insert image in a category other than summary #1996)
  • Issue: The "Insert Horizontal Rule" and "Insert Break Line" buttons in the editor toolbar would trigger the submission of section_dialog, make these buttons unusable.

Changes Made

  1. 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.

  2. 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

  • Clicking the "Insert Image" button inserts the image without submitting the section_dialog form.
  • Using the "Insert Horizontal Rule" and "Insert Break Line" buttons performs the respective actions without submitting the section_dialog form

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!

@2368883029 2368883029 changed the title Fix: Prevent Unintentional Form Submission on Image Insert and Toolbar Actions Fix(client): Prevent Unintentional Form Submission on Image Insert and Toolbar Actions Jul 21, 2024
@2368883029 2368883029 changed the title Fix(client): Prevent Unintentional Form Submission on Image Insert and Toolbar Actions Fix(client): Fix Unintentional Form Submission on Image Insert and Toolbar Actions Jul 21, 2024
@2368883029 2368883029 changed the title Fix(client): Fix Unintentional Form Submission on Image Insert and Toolbar Actions Fix(client): Fix Unintentional Form Submission on Rich-input Toolbar Actions Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Can't insert image in a category other than summary
2 participants