Make WordPress Core

Opened 9 years ago

Last modified 2 years ago

#42751 new defect (bug)

Can we please enqueue media-views independently ?

Reported by: Themezly Owned by:
Priority: normal Milestone: Awaiting Review
Component: Media Version: 4.9
Severity: normal Keywords: phase-3-media-triage
Cc: Focuses: administration

Description

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

/*  
 * use theme mediaelement CSS
 */
wp_deregister_style('mediaelement');
wp_deregister_style('wp-mediaelement');	

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

​http://prntscr.com/hh0808 ?

CSS files should always be in head.

Change History (5)

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


8 years ago

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


3 years ago

#3 @antpb
3 years ago

  • Keywords phase-3-media-triage added

#4 @pbearne
2 years ago

  • Focuses performance removed

#5 @sabernhardt
2 years ago

a search found about ​20 themes that deregistered the styles

Note: See TracTickets for help on using tickets.