AdvancedCustomFields / AdvancedCustomFields/acf
Block toolbar does not render when using display: contents; on wrapping divs
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
This has come up before, but seems worthy of documenting via a separate issue. This behavior was noticed via https://github.com/AdvancedCustomFields/acf/issues/465#issuecomment-1251068524 and seems to be somewhat related to the discussion in core/gutenberg in https://github.com/WordPress/gutenberg/issues/7694. Also, in regards to @polevaultweb's comment via https://github.com/AdvancedCustomFields/acf/issues/654#issuecomment-1251474124, it made sense to open a new issue to keep the discussion focused.
The TL;DR of this issue is that CSS flexbox and grid don't work in the editor because WP/ACF require extra wrapping divs around nested blocks. Using display: contents; on these inner elements helps flexbox/grid to work correctly but we lose the block toolbar.
I'm not sure if this is preventable in ACF but I wanted to bring it up here to confirm. If there was a fix/workaround, then it would make many of our lives easier since we wouldn't have to battle so hard with editor styling to get our blocks to work in the back end.
The CSS we're talking about is:
.my-block > .acf-innerblocks-container,
.my-block > .acf-innerblocks-container > .block-editor-block-list__layout {
display: contents;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the editor behavior with the provided display: contents CSS on the wrapping elements, then review the linked ACF and Gutenberg discussions. The issue does not name files or tests; completion would require establishing whether the missing block toolbar can be prevented or worked around and documenting the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, php
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100