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

Open
#1,006 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
javascript, php
Domain
frontend, web-dev

Research direction

Reproduce the issue with the documented lockPostSaving() dispatch and an ACF Blocks V3 expanded editor modal. Start by tracing the ACF Blocks V3 modal integration and its handling of the WordPress editor lock; done means the modal can be dismissed while post saving remains locked.

Written by the indexing model from the issue text.

Description

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
Dominant language
PHP
Stars
947
Forks
198
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AdvancedCustomFields/acf

All issues in AdvancedCustomFields/acf

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.