Support

Account

Home Forums Bug Reports Block stops working in FireFox

Unread

Block stops working in FireFox

  • Hello,
    I have a block

    add_action('acf/init', 'my_acf_init_block_types');
    function my_acf_init_block_types() {
    
        // Check function exists.
        if( function_exists('acf_register_block_type') ) {
    
            // register a testimonial block.
            acf_register_block_type(array(
                'name'              => 'test',
                'title'             => __('Test'),
                'description'       => __('A custom testimonial block.'),
                'render_template'   => 'my-blocks/test.php',
                'category'          => 'formatting',
                'icon'              => 'admin-comments',
                'keywords'          => array( 'testimonial', 'quote' ),
    			'supports'		    => array(
    				'jsx' => true,
                ),
            ));
        }
    }

    and my script to render. when checked it puts a border around a div.

    <?php
        $style = '';
        $check = get_field('check');
        if($check) {
            $style = 'border: 1px solid red;';
        }
    ?>
    
    <div class="container" style="padding: 100px; <?php echo $style; ?>">
        <InnerBlocks />
    </div><!-- .container -->

    this works perfect in chrome. but in firefox it will work at first but eventually after toggling a few times, saving and refreshing the page it will stop updating. I’ve been on this for a few days and I wish I could give you specific instructions on how to do it but really it’s just toggling and refreshing the page.

    The one thing I did notice is that when you select the block the first time in FF, instead of selecting the block your cursor jumps down into the nested paragraph. which is weird I thought maybe this was a new wordpress thing but it’s not happening in chrome.

    here is a video of the issue https://drive.google.com/file/d/1XKIterZQbO0kP4L61JKOULhtdQ_hR26m/view?usp=sharing

    steps to reproduce (again can’t guarantee it, it seems random)

    1. add the acf_register_block_type script to functions.php
    2. add the render script above to my-blocks/test.php
    3. create a field group for your block that consists of a checkbox (name = ‘check’)
    4. add the test block to a page.
    5. add columns inside and add a paragraph to each column
    6. select the test block (you should see the cursor jump inside your block and select a paragraph ready to type)
    7. select the test block again
    8 start toggling the checkbox and you should see the border appearing and disappearing.
    9. save the page and refresh.
    10. select the test block (since it will select the paragraph you need to do it twice). then try toggling again and you will see it’s not updating. again you might have to do this a few times but eventually it will break.

    I’m using FF 103.0.2
    php 8.0
    wordpress 6.0.1
    acf 5.12.3

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.