Skip to content

Conversation

@t-hamano
Copy link
Contributor

@t-hamano t-hamano commented Oct 2, 2025

What?

Add blockVisibility support to Synced Pattern and Template Part

Why?

When I initially implemented the Block Visibility feature, I disabled this feature for generic blocks just to be safe. However, this feature should work perfectly in such blocks.

Testing Instructions

  • Create a synced pattern.
  • Open the site editor.
  • Try to hide and show template parts and synced pattern.

Screenshots or screencast

bd7f56c09340efb48e1f3ee367a345d2.mp4

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Feature] Block API API that allows to express the block paradigm. labels Oct 2, 2025
@t-hamano t-hamano self-assigned this Oct 2, 2025
@t-hamano t-hamano requested review from ramonjd and talldan October 2, 2025 09:27
@t-hamano t-hamano marked this pull request as ready for review October 2, 2025 09:27
@github-actions
Copy link

github-actions bot commented Oct 2, 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: t-hamano <[email protected]>
Co-authored-by: ramonjd <[email protected]>

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

@github-actions
Copy link

github-actions bot commented Oct 2, 2025

Flaky tests detected in c4827a5.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18189006769
📝 Reported issues:

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

This is working well for me.

I tested both template parts and synced patterns in editor and frontend.

Not sure if this is worth worrying about, but I found an edge case that, when all blocks on a page are hidden, you can no longer interact with the canvas.

E.g., there's no empty paragraph block and you can only add new blocks using after/before in the list view.

@t-hamano
Copy link
Contributor Author

t-hamano commented Oct 3, 2025

@ramonjd Thanks for the review!

Not sure if this is worth worrying about, but I found an edge case that, when all blocks on a page are hidden, you can no longer interact with the canvas.

I'll try to think of a better solution 👀

@t-hamano t-hamano merged commit 9529ccd into trunk Oct 3, 2025
101 of 120 checks passed
@t-hamano t-hamano deleted the block-visibility/enable-synced-and-template-part branch October 3, 2025 02:49
@github-actions github-actions bot added this to the Gutenberg 21.9 milestone Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block API API that allows to express the block paradigm. [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants