Skip to content

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

@ouun

Description

@ouun

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions