Support

Account

Home Forums Gutenberg Interactivity API Support For ACF Blocks

Unread

Interactivity API Support For ACF Blocks

  • Do ACF Blocks support the @wordpress/interactivity API?

    I’m looking to create a custom navigation menu that requires more customization than what the default Gutenberg nav block allows, so I’m creating my own custom nav ACF block. The default block uses the interactivity API to trigger things like the modal window opening on mobile devices, and I’d like to leverage that for my menu, without having to include any external libraries.

    My block.json file:
    {
    "name": "acf/menu",
    "title": "Advanced menu",
    "description": "A custom menu module with expandable mobile menus",
    "script": "file:./interactivity.js",
    "style": [ "file:./menu.css" ],
    "category": "theme",
    "icon": "menu",
    "keywords": ["menu", "nav", "mobile"],
    "acf": {
    "mode": "preview",
    "renderTemplate": "menu.php"
    },
    "supports": {
    "anchor": true,
    "jsx": true,
    "interactivity": true,
    "mode": false
    }
    }

    As per the API handbook, I’ve tried adding “data-wp-interactive” to my menu, but nothing happens. (It’s very possible I’m missing a step, or forgetting something though)

    Any ideas?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.