Skip to content

Search Block: Move search setting to inspector #70144

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

Conversation

Infinite-Null
Copy link
Contributor

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

What?

Moving Search block display controls from the toolbar to the inspector panel for better consistency with other core blocks.

Closes: #70138

Why?

Currently, the Search block has several display options in the toolbar (Show search label, Change button position, Use button with icon), while most core blocks place such settings in the inspector panel. This PR enhances consistency across core blocks and improves the user experience by organizing all display settings in a single location.

How?

The implementation:

  1. Moves the "Show search label" toggle from the toolbar to the inspector panel
  2. Moves the "Use button with icon" toggle from the toolbar to the inspector panel
  3. Replaces the dropdown menu for button position with a SelectControl in the inspector panel
  4. Removes the BlockControls section entirely as all controls are now in the inspector

Testing Instructions

  1. Add a Search block to a post or page
  2. Observe that the toolbar no longer contains the display controls
  3. Open the block settings sidebar (inspector)
  4. Verify that all the following controls are now in the Settings panel:
    • Show search label (toggle)
    • Use button with icon (toggle)
    • Change button position (select dropdown with options: Button outside, Button inside, No button, Button only)
  5. Test each setting to ensure they function correctly

Screenshots

Before After
image image

@Infinite-Null Infinite-Null marked this pull request as ready for review May 16, 2025 07:10
Copy link

github-actions bot commented May 16, 2025

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>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>

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

@Infinite-Null
Copy link
Contributor Author

Hi @hanneslsm,
I’ve moved the settings to the Inspector Controls. When you have a moment, please feel free to review the changes at your convenience. Thanks!

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Block] Search Affects the Search Block - used to display a search field labels May 16, 2025
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 suggestions, but let's wait for design feedback.

@t-hamano t-hamano added the Needs Design Feedback Needs general design feedback. label May 16, 2025
@t-hamano t-hamano requested a review from a team May 16, 2025 12:31
@Infinite-Null
Copy link
Contributor Author

Hi @t-hamano, I have made all the necessary changes to the PR please review it at your convenience.

@Infinite-Null Infinite-Null requested a review from t-hamano May 19, 2025 05:09
@hanneslsm
Copy link

hanneslsm commented May 19, 2025

Thanks for the PR @Infinite-Null!

I'd change the order.
"Use button with icon" could be below the dropdown and should not be shown when "No button" is selected.

I'm not happy that the "Show label" is just below the width settings, it looks too much as if they were connected. I wonder if we either should add another heading for the label. Or maybe we could change the order: label toggle, button position, button toggle, width settings. I guess this way it's easy to distinguish what is related to what. 😃

@t-hamano
Copy link
Contributor

"Use button with icon" should not be shown when "No button" is selected.

Yes, this makes sense. In the original implementation, the "Use button with icon" button is not displayed when "No button" is selected.

@Infinite-Null
Copy link
Contributor Author

Hi @t-hamano and @hanneslsm,
I have updated the PR with the changes.

Screencast:

Screen.Recording.2025-05-20.at.4.24.33.PM.mov

@Infinite-Null Infinite-Null requested a review from hanneslsm May 20, 2025 12:04
@hanneslsm
Copy link

Thanks for the Updates @Infinite-Null

Let's put width settings below the display settings and then we're good to go I think.

@Infinite-Null
Copy link
Contributor Author

Hi @hanneslsm,
Thank you for the feedback. I have updated the PR with the necessary changes. Please review it at your convenience.

Screencast:

Screen.Recording.2025-05-21.at.12.33.17.PM.mov

@hanneslsm
Copy link

Nice, thanks @Infinite-Null
Design LGTM!

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.

@t-hamano t-hamano merged commit 798b947 into WordPress:trunk May 22, 2025
73 of 91 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.9 milestone May 22, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
* Move `showLabel` to inspector control

* Move `buttonUseIcon` to inspector control

* Move `buttonPosition` to inspector control

* Remove block controls

* Add settings to `resetAll`

* Refactor button position label and simplify state update logic

* Update label for show label toggle and reposition button icon control

* Change position of width settings

* Remove unused SVG icon components from search icons

Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Search Affects the Search Block - used to display a search field Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search: Move display settings to the inspector
4 participants