Home › Forums › Gutenberg › ACF Blocks v3 autoInlineEditing stops working when a text field contains inline
Hi,
I have encountered an issue with automatic inline editing in ACF Blocks v3.
Environment
autoInlineEditing enabledExample block.json configuration:
{
"apiVersion": 3,
"name": "example/hero",
"acf": {
"blockVersion": 3,
"mode": "preview",
"renderTemplate": "render.php",
"autoInlineEditing": true
}
}
Example render template:
<?php
$heading = get_field('heading');
?>
<h2>
<?php echo wp_kses_post((string) $heading); ?>
</h2>
When the field contains plain text, for example:
Example heading
ACF correctly identifies the <h2> element and adds the inline-editing attributes. Inline editing works as expected.
However, when the field value contains inline HTML:
Example <strong>formatted text<strong>
inline editing stops working after the block preview is rendered again. The corresponding element no longer receives data-acf-inline-contenteditable, so the field can only be edited through the sidebar or expanded editor.
Steps to reproduce
autoInlineEditing enabled.heading.wp_kses_post().<strong> or <em>.Expected result<
The original container should remain inline-editable when its field value contains supported inline HTML elements such as <strong> or <em>.
Actual result
After the preview is rendered again, ACF no longer identifies the container as belonging to the text field, and the data-acf-inline-contenteditable attributes are missing.
Current workaround
Explicitly adding the mapping works:
<h2 <?php echo acf_inline_text_editing_attrs('heading'); ?>>
<?php echo wp_kses_post((string) get_field('heading')); ?>
</h2>
However, this requires manually annotating every field and reduces the usefulness of autoInlineEditing.
Would it be possible for automatic inline editing to support values containing inline HTML—for example by comparing normalized innerHTML, complete textContent, or otherwise preserving the field-to-element association across preview renders?
Thank you.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.