AdvancedCustomFields / AdvancedCustomFields/acf

Allow defining a tagName for InnerBlocks

Open
#703 10 comments 5 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

hey @lgladdy,

Using the ACF <InnerBlocks> tag allow us to set a class name and in combination with add_filter( 'acf/blocks/wrap_frontend_innerblocks', ... ) filter we can output the wrapper div for back end and front end.

But in some cases this leads to wrong semantics.

If my block wrapper tag is a <ul> list, the <InnerBlocks> output wrapper tag is always a <div>. The result is:

<ul class="acf-block-wrapper">
    <div class="acf-inner-blocks-container">block content</div>
    <div class="acf-inner-blocks-container">block content</div>
</ul>

But it should be:

<ul class="acf-block-wrapper">
    <li class="acf-inner-blocks-container">block content</li>
    <li class="acf-inner-blocks-container">block content</li>
</ul>

Is there a way to define a tagName for the <InnerBlocks> tag? Like:

<InnerBlocks tagName="li" class="list-item" />

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 tracing how the ACF InnerBlocks tag generates its wrapper and how the acf/blocks/wrap_frontend_innerblocks filter affects it. Check the existing InnerBlocks handling before deciding where the requested tagName option belongs. Done means allowing a custom wrapper tag such as li while preserving the class and valid list markup.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.