acf-composer icon indicating copy to clipboard operation
acf-composer copied to clipboard

🐞 Issue: `align: ""` is stripped, causing fallback to default align setting on load

Open ouun opened this issue 5 months ago β€’ 0 comments

Explicitly setting align: "" β€” such as when a user sets alignment to β€œnone” β€” does not persist. It’s stripped during editor load, before saving, causing the block to fall back to its default alignment value (e.g. "full").

Steps to reproduce:

  1. Define an ACF block via acf-composer with:
public $align = 'full';

public $supports = [
  'align' => true,
  // ...
];
  1. Insert the block β†’ it appears with align="full" βœ…

  2. Reset alignment to none in the editor β†’ sets align: "" βœ…

  3. Reload the editor

  4. Notice in editor markup that align is already removed β†’ it was stripped on load

  5. The block then renders with default align setting again, e.g. "full" ❌

Expected behavior: ACF-composer should preserve explicit empty alignment attributes. If a user chooses no alignment, align: "" should persist through serialization and rendering, matching native blocks like core/cover.

What next: This needs further testing & debugging (cached/uncached). A good starting point is here: https://github.com/Log1x/acf-composer/blob/master/src/Block.php#L391-L514

ouun avatar Jun 12 '25 11:06 ouun