WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#33253 new defect (bug)

Some admin buttons not styled correctly in IE9 when not using post-thumbnails

Reported by: kurdt_the_goat Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.2.3
Component: Post Thumbnails Keywords:
Focuses: Cc:

Description

When add_theme_support('post-thumbnails') is not implemented, some admin buttons have style issues (no border/bg) in IE9. Some i've noticed are:

  • Add Media above wysiywg
  • Insert buttons bottom right of Add Media modal (buttons are essentially invisible once a file has been selected since text is white/no bg)

The same thing happens for custom post types that don't support 'thumbnail'

Attachments (1)

ie9 button style issues.jpg (203.6 KB) - added by kurdt_the_goat 3 years ago.

Download all attachments as: .zip

Change History (3)

#1 @ZZmmrmn
3 years ago

If a post type doesn't have support for thumbnails this same issue will apply to just that post type. Additionally if wp_enqueue_media is called during the admin_enqueue_scripts hook the media library modal styles will break.

Steps To Replicate With a clean install of 4.2.4 using the 2015 theme and viewing in IE9. Add to functions.php

register_post_type(
    'demo',
    array(
        'labels' => array(
            'name' => 'Demo Type',
            'singular_name' => 'Demo Type',
        ),
        'public' => true,
        'supports' => array( 'title', 'editor' )
    )
);

The button styles on demo post edit pages will be broken. If we add to functions.php

function enqueue_media( ){
    wp_enqueue_media( );
}
add_filter( 'admin_enqueue_scripts', 'enqueue_media' );

Now the styles for the Media Library modal will be broken on demo post edit pages.

Notes When using plugins like ACF wp_enqueue_media is called on most edit screens resulting in broken Media Library modals.

wp-admin/edit-form-advanced.php calls wp_enqueue_media before admin_enqueue_scripts is triggered if support for thumbnails is true. This causes the buttons and media-view stylesheets to be loaded before the wp-admin stylesheet, resulting in the styles working correctly. Its when the buttons and media-view stylesheets are enqueued after the wp-admin stylesheet that things break.

As a work around you can move the wp-admin stylesheet to the end of the enqueue list by adding this to functions.php

function filter_styles_enqueue_order( $styles ){
    if( is_admin( ) ){
        unset( $styles[ array_search( 'wp-admin', $styles ) ] );
        $styles[] = 'wp-admin';
    }
    return $styles;
}

This ticket was mentioned in Slack in #core by flixos90. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.