Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#42751 new defect (bug)

Can we please enqueue media-views independently ?

Reported by: themezly's profile Themezly Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Media Keywords:
Focuses: administration, performance Cc:


Many of theme developers are styling mediaelement to their preference and this is a first step when they do so;

 * use theme mediaelement CSS

that disables the default CSS and lets us use our own. Issue with this is that
buttons, imgareaselect and media-views CSS files depend on these and if anyone is using a frontend page builder or anything that needs media library in frontend, these 3 CSS files are not present.

My first tought was

 * since we have deregistered medialement style
 * make sure media dependencies are loaded 
 * in case of frontend editros
if( is_user_logged_in() ){
	wp_enqueue_style( 'buttons' );
	wp_enqueue_style( 'imgareaselect' );
	wp_enqueue_style( 'media-views' ) ;


but to my surprise media-views which is a key CSS file for media library is not loading since it is a dependent.

I know that I can do the direct enque but since we have a handle we should be able to use it independently from other styles.

While we are at it, why are we loading mediaelement CSS files at the bottom of body ?

CSS files should always be in head.

Change History (1)

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

4 years ago

Note: See TracTickets for help on using tickets.