Site logo

[Support request] Generatepress style overriding ACF Block default block styles in editor

Home Forums Support [Support request] Generatepress style overriding ACF Block default block styles in editor

Home Forums Support Generatepress style overriding ACF Block default block styles in editor

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2423821
    Fabien

    Hi,

    Generatepresss styles (cf. customizer) are overidding ACF / wp-core-ui default blocks styles.

    Example with a repeater field below :

    What it look like (due to GP styles) :

    What it should look like :

    Is their a way to fix this easily ? In the long rung I think it should be handle by GP.

    Thanks

    #2424484
    Leo
    Staff
    Customer Support

    Hi there,

    Are you able to provide the CSS that you think it’s causing the issue?

    Let me know 🙂

    #2424510
    Fabien

    Yes, definately (might not be exhaustive) :

    .editor-styles-wrapper .block-editor-block-list__layout .wp-block-button .wp-block-button__link, .editor-styles-wrapper .block-editor-block-list__layout .button {
        font-size: inherit;
        padding: 10px 15px;
        line-height: normal;
    }
    
    .editor-styles-wrapper a.button, .editor-styles-wrapper .block-editor-block-list__layout .wp-block-button .wp-block-button__link {
        font-weight: 700;
        text-transform: uppercase;
        font-size: inherit
    }
    
    .editor-styles-wrapper a.button, .editor-styles-wrapper a.button:visited, .editor-styles-wrapper .wp-block-button__link:not(.has-background) {
        color: #ffffff;
        background-color: #00b62c;
        padding: 10px 20px;
        border: 0;
        border-radius: 0;
    }
    
    .editor-styles-wrapper a, .editor-styles-wrapper a:visited {
        color: #00b62c;
    }

    Those are inline styles generated by Generatepress (cf. customizer) and they are overiding ACF / wp-core-ui default styles/

    #2426204
    Fabien

    Hi @Leo,

    Any news on this ?

    #2426371
    Fernando
    Customer Support

    Hi Fabien,

    Can you provide admin login credentials so we can take a closer look at what’s occurring?

    Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

    We’ll try to provide an assessment afterward.

    #2428585
    Fabien

    Here you go !

    #2428841
    David
    Staff
    Customer Support

    Hi there,

    does this snippet fix the issue ?

    
    add_filter( 'block_editor_settings_all', function( $editor_settings ) {
        
        $css = '.button.button-small {
            padding: 0 8px;
        }';
        $editor_settings['styles'][] = array( 'css' => $css );
        
        return $editor_settings;
    } );
    #2429024
    Fabien

    Hi David,

    Thanks for your reply !

    Yes it does but there was a little mistake : padding-bottom: 0 8px; should be padding: 0 8px;

    Now, the ‘add row’ button should be fixed (in order to be blue, with border radius and so on… in order to not inherit GP styles). Can you please help ?

    Thanks

    #2429076
    David
    Staff
    Customer Support

    Yikes sorry about the CSS error lol – corrected the code above.

    I can’t stop ACF and the editor buttons from inheriting those styles.

    This is the issue. GP loads its front end styles in the editor.
    This for example is one of those styles:

    
    a.button {
        font-weight: 700;
        text-transform: uppercase;
        font-size: inherit
    }

    And we load it using the core functions, which automatically adds the necessary editor selectors eg. .editor-styles-wrapper which makes it more specific then the Core UI Buttons. Its a stupid system of core and they should address it by ensuring their core buttons have more specificity in their styles…. for now you would need to re-add the styles eg.

    
    add_filter( 'block_editor_settings_all', function( $editor_settings ) {
        
        $css = '.button.button-small {
            padding: 0 8px;
        }
        .wp-core-ui .button-primary {
            background: #2271b1;
            border-color: #2271b1;
        }
        ';
        $editor_settings['styles'][] = array( 'css' => $css );
        
        return $editor_settings;
    } ); 
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.