AdvancedCustomFields / AdvancedCustomFields/acf

Block without Editable Fields and without edit mode disabled still has Edit icon in toolbar when using Block API v3

Open
#1,002 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
A block without editable fields, and told to always be in preview mode, still has the Edit icon in its Block Toolbar when using Block API v3 (but not v2)

To Reproduce
Steps to reproduce the behavior:

  1. Create a block without any field groups assigned to it
  2. In its block.json, set acf:mode = preview, and set supports:mode = false
  3. Insert the block on a Post
  4. See that its toolbar has an Edit icon when using V3 of the Block API (but not if using V2)

Expected behavior
No Edit icon is present in the block toolbar.

Screenshots or Video
Image

Code
`{
"name": "acf/ext-social-share-links",
"title": "Social Share Links",
"description": "Social Sharing Links",
"style": "file:./css/ext-social-share.css",
"icon": "share-alt2",
"category": "widgets",
"keywords": ["social", "share", "twitter", "facebook"],
"acf": {
"mode": "preview",
"renderTemplate": "block_template.php"
},
"supports": {

    "align": false,
    "alignText": true,
    "color": {
        "background": true,
        "text": true,
        "link": true
    },
    "jsx": false,
    "mode": false,
    "spacing": {
        "blockGap": false,
        "margin": [
            "top",
            "bottom"
        ],
        "padding": true
    }
},
"example": {
    "attributes": {
        "mode": "preview",
        "data": {
            "ext_acf_block_preview": 1
        }
    }
}

}`

Version Information:

  • WordPress Version 6.9.1
  • PHP Version 8.3.30
  • ACF Version 6.7.1
  • Browser Chrome 145.0.7632.160

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by reproducing the issue with a block that has no field groups, acf.mode set to preview, and supports.mode set to false. Compare the Block API v3 toolbar with v2, then verify that the Edit icon is absent from the v3 toolbar when the fix is complete.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.