Skip to content

Form: Convert Form block settings to ToolsPanel #70253

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

Merged
merged 4 commits into from
May 30, 2025

Conversation

Infinite-Null
Copy link
Contributor

@Infinite-Null Infinite-Null commented May 28, 2025

What?

Refactors the Form block's settings panel to use ToolsPanel instead of PanelBody.

Closes #70242

Why?

This change updates the Form block to align with the ongoing effort to standardize block inspector controls across Gutenberg using the ToolsPanel component. Leveraging ToolsPanel enhances the user experience by introducing reset functionality, improved control organization, and consistent UI patterns across all blocks.

Testing Instructions

  1. First, make sure the experimental feature Blocks: add Form and input blocks is turned ON
  2. Open a post or page in the block editor
  3. Insert a Form block
  4. Open the block inspector
  5. Verify the "Settings" panel displays with ToolsPanel UI

Screenshots

Before After
image image

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Form (experimental) Affects the form block labels May 29, 2025
@Infinite-Null Infinite-Null changed the title Form: Convert Form Input block settings to ToolsPanel Form: Convert Form block settings to ToolsPanel May 30, 2025
@Infinite-Null Infinite-Null marked this pull request as ready for review May 30, 2025 06:37
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I've left some feedback, but please remember that the reset action changes the attribute to its "default value".

@Infinite-Null
Copy link
Contributor Author

Hi @t-hamano, Thank you for the fooedbacks. I have made the necessery changes please review the PR at your convenience.

@Infinite-Null Infinite-Null requested a review from t-hamano May 30, 2025 11:52
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Finally, it would be good to make the following change to avoid a browser warning when changing the "Email for form submissions" field:

diff --git a/packages/block-library/src/form/edit.js b/packages/block-library/src/form/edit.js
index 7d7249f892..13f7086eb3 100644
--- a/packages/block-library/src/form/edit.js
+++ b/packages/block-library/src/form/edit.js
@@ -155,7 +155,7 @@ const Edit = ( { attributes, setAttributes, clientId } ) => {
                                                                __next40pxDefaultSize
                                                                autoComplete="off"
                                                                label={ __( 'Email for form submissions' ) }
-                                                               value={ email }
+                                                               value={ email || '' }
                                                                required
                                                                onChange={ ( value ) => {
                                                                        setAttributes( { email: value } );
d3f883df2cf66d0d57bba3542f5194f1.mp4

@Infinite-Null
Copy link
Contributor Author

Hi @t-hamano, I have made the changes and after testing the error form console is gone 🎉

Screencast:

Screen.Recording.2025-05-30.at.6.14.57.PM.mov

@Infinite-Null Infinite-Null requested a review from t-hamano May 30, 2025 12:46
@t-hamano t-hamano merged commit 4a95180 into WordPress:trunk May 30, 2025
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.0 milestone May 30, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
* Enhance form settings with ToolsPanel for improved submission method management

* Refactor email handling in form edit component to use empty string as default value

* Refactor form edit component to use ToolsPanel dropdown and update default attribute values

* Fix email input default value to empty string in form edit component

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Form (experimental) Affects the form block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor "Settings" panel of Form block to use ToolsPanel instead of PanelBody
2 participants