Skip to content

Conversation

@priethor
Copy link
Contributor

@priethor priethor commented Dec 4, 2025

What

Fixes block validation failing on WordPress 6.2, allowing posts to publish despite validation errors in blocks.

Why

While working on #271 to make e2e tests compatible with WP 6.2, one test failed for a valid reason related to production code: togglePublishSidebar() was added in WordPress 6.3 and doesn't exist in 6.2. The error broke the promise chain before it could return hasError = true. This caused the validation to silently fail, allowing posts with invalid blocks to be published.

How

Checking if togglePublishSidebar exists before calling it:

  • The function is only used for closing the publish panel; validation logic is unaffected
  • When the method doesn't exist, we skip the panel close, but validation still works correctly

Testing Instructions

  1. Set up an instance of WordPress 6.2
  2. Create a post with a testimonial block, or any SCF block with required fields
  3. Clear a required field and try to publish
  4. Verify the post is NOT published, and an error notice appears

@priethor priethor requested a review from cbravobernal December 4, 2025 07:18
@priethor priethor self-assigned this Dec 4, 2025
@priethor priethor added the [Type] Bug Something isn't working label Dec 4, 2025
@github-actions
Copy link

github-actions bot commented Dec 4, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor, cbravobernal.

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

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 9.37%. Comparing base (342675c) to head (f2f82a2).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##             trunk    #272   +/-   ##
=======================================
  Coverage     9.37%   9.37%           
  Complexity    4288    4288           
=======================================
  Files          266     266           
  Lines        33159   33159           
=======================================
  Hits          3108    3108           
  Misses       30051   30051           
Flag Coverage Δ
e2e 21.83% <ø> (ø)
phpunit 6.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor priethor force-pushed the fix/scf-block-validation-in-wp62 branch 2 times, most recently from 2d475aa to e91e965 Compare December 4, 2025 07:55
@priethor priethor force-pushed the fix/scf-block-validation-in-wp62 branch from e91e965 to f2f82a2 Compare December 4, 2025 07:56
Copy link
Contributor

@cbravobernal cbravobernal left a comment

Choose a reason for hiding this comment

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

LGTM. But maybe we should increase the minimum WP Version.

@cbravobernal cbravobernal merged commit 2f9fe48 into trunk Dec 4, 2025
9 checks passed
@cbravobernal cbravobernal added this to the 6.7.1 milestone Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants