Skip to content

Form Input: Convert Form Input block settings to ToolsPanel #70249

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

Conversation

himanshupathak95
Copy link
Contributor

@himanshupathak95 himanshupathak95 commented May 28, 2025

What?

Closes #70243

Refactors the Form Input block's settings panel to use ToolsPanel instead of PanelBody for improved UI consistency and enhanced reset functionality.

Why?

This change aligns the Form Input block with the ongoing effort to standardize block inspector controls across Gutenberg using ToolsPanel. The ToolsPanel component provides a better user experience with reset capabilities, improved organization, and consistent UI patterns across all blocks.

How?

  • Replaced PanelBody with ToolsPanel in the InspectorControls
  • Wrapped existing controls in ToolsPanelItem components
  • Added resetAll functionality to reset both inline label and required settings to their defaults
  • Added dropdown menu props for consistent UI behavior

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. Select any input field block
  5. Open the block inspector
  6. Verify the "Settings" panel displays with ToolsPanel UI
  7. Test the "Inline label" and "Required" control
  8. Use the reset button to reset individual and all settings and verify that everything works as expected

Screencast

Before

Screen.Recording.2025-05-30.at.11.38.18.mov

After

Screen.Recording.2025-05-30.at.11.36.00.mov

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Form (experimental) Affects the form block labels May 29, 2025
@himanshupathak95 himanshupathak95 marked this pull request as ready for review May 30, 2025 06:11
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: himanshupathak95 <abcd95@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!

It almost looks good, but we need to make some tweaks because the default value of the required attribute is false.

@himanshupathak95
Copy link
Contributor Author

the default value of the required attribute is false.

@t-hamano You're correct, but as we can see from the 'Before' screencast, the required check is enabled by default, that's why I kept it true.

I have made the changes in the latest commit.

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!

as we can see from the 'Before' screencast, the required check is enabled by default

This is because the Form block explicitly defines the opposite of the default value as a template.

See:

@t-hamano t-hamano merged commit f166bae into WordPress:trunk Jun 2, 2025
60 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.0 milestone Jun 2, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…s#70249)

* Form Input: Convert Form Input block settings to ToolsPanel

* Form Input: Align initial settings with the default configuration

* Form Input: Update default value for the required field to true

Co-authored-by: himanshupathak95 <abcd95@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 Input Field block to use ToolsPanel instead of PanelBody
2 participants