Support » Plugin: Block Visibility — Conditional Visibility Control for the Block Editor » Issue when using editor.BlockListBlock block hook

  • Resolved rose18



    This is a great plugin that help hide blocks without having to delete it in the editor, but it’s causing an issue when I am these WordPress hooks to extend the core blocks.

    I am using these WordPress block hooks:

    • blocks.registerBlockType
    • blocks.getSaveContent.extraProps
    • editor.BlockEdit
    • editor.BlockListBlock

    I was able to add an extra ToggleControl field.
    My issue happens when I use editor.BlockListBlock ( to add a class name in the editor.

    Once I enable my custom toggleControl to true, it adds in my custom class name, but is also add in this plugin block visibility class name (block-visibility__has-visibility). Now this block has these contextual indicator styles showing up (red outline, opacity set to 40% and the eye icon on the top right) even though this block visibility is set to false.

    Screenshots below:

    The ‘Enable Drop Shadow’ ToggleControl is a custom control that I’ve created using the WordPress block hooks. When I removed the ‘editor.BlockListBlock’ hook in my code the issue is gone.

    I would like to know is there a way to fix this issue?

    Below is the editor.BlockListBlock code:

    const shadowBlockListBlock  = createHigherOrderComponent( ( BlockListBlock ) => {
        return ( props ) => {
            if ( ! enableDropShadowControlOnBlocks.includes( ) ) {
                return (
                    <BlockListBlock { ...props } />
            const { attributes } = props;
            const { hasDropShadow } = attributes;
    			return <BlockListBlock { ...props } className={ hasDropShadow ? 'has-drop-shadow' : '' } />;
    }, 'shadowBlockListBlock' );


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Nick Diego


    Hi @rose18,

    Thank you for this detailed support ticket. I have tested your code and was able to replicate the issue. It appears that a bug was introduced in the last version, which attempted to resolve a separate issue related to the editor.BlockListBlock filter.

    That said, I have just pushed version 2.5.4 which should resolve the issue for you. Please let me know if I can be of further assistance.


    Thread Starter rose18


    Thank you @ndiego ! The latest version help fixed the issue!

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.