Home Forums Gutenberg acf_register_block_type styles problem in ACF 5.10.x Reply To: acf_register_block_type styles problem in ACF 5.10.x

  • Something definitely changed from 5.9 to 5.10. I’ve been looking/waiting for a fix to this for weeks now. I also have a series of simple blocks that were all working fine prior to v5.10.x. I am using $block[‘backgroundColor’] and $block[‘textColor’] to apply the appropriate CSS classes to my blocks. Works fine on the front-end, but in the editor, it doesn’t work at all. Using my dev tools, it looks like everything inside of the “acf-block-preview” div is a click behind the div with a data-type of “acf/your-block-name”:

    1. Insert Block
    2. Select color-1. CSS class gets applied to wrapping div (with data-type), nothing get applied to div inside “wp-block-preview”.
    3. Select color-2. Correct color css class gets applied to wrapping div, but the inner div gets the class for the LAST color you selected applied (color-1).
    4. Proceed to bang head on desk

    I’ve basically had to resort to writing CSS that forces the wrapper to be transparent (with an !important tag), and then use the class that gets applied to that to style the inner div the way it is supposed to be. Very frustrating. I hope there is a fix soon that hopefully doesn’t break the my hacky solution that I’ve had to use over the last six weeks moving forward. I haven’t even seen this problem reported in the forums, which is very surprising. This thread appears to have been posted about 4 weeks ago and it is marked as “Unread.”