Skip to content

Usage of lockPostSaving() to lock the post editor prevents dismissing the ACF Blocks V3 expanded editor modal #1006

@smwoll

Description

@smwoll

Describe the bug
In our custom block work, we lock post saving when certain required fields are empty using lockPostSaving() like so:
dispatch('core/editor').lockPostSaving('our-theme-custom-lock-id');

This causes the ACF block V3 expanded modal to lock, preventing dismissal.

To Reproduce
Steps to reproduce the behavior:

  1. Add editor JS to lock the post editor using a custom lock, or try this in the browser console with the WP editor open: window.wp.data.dispatch('core/editor').lockPostSaving('my-example-lock-id');. This should lock post saving/publishing.
  2. Select an ACF block and click the "Open Expanded Editor" button to expand the ACF block form modal.
  3. Attempt to click the modal dismiss button labeled "done" or otherwise attempt to dismiss and close the modal to return to the editor.

Expected behavior
We would expect that locking post saving does not lock the ACF expanded edit modal, and that this modal is dismissible even if post saving is locked. This issue prevents users from closing the modal and addressing anything else in the editor.

Screenshots or Video
Image

Code
Relevant example block.json below. I found that no fields need to be registered to the block. The modal cannot be dismissed regardless of the block's registered fields.

{
	"$schema": "https://schemas.wp.org/trunk/block.json",
	"apiVersion": 3,
	"title": "Example Block",
	"textdomain": "my-custom-domain",
	"name": "myplugin/myblockname",
	"icon": "feedback",
	"category": "text",
	"acf": {
		"blockVersion": 3,
		"renderTemplate": "template.php"
	},
	"style": "file:./style.min.css"
}

Version Information:

  • WP version 6.9.4
  • PHP version 8.4
  • ACF Pro 6.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions