Make WordPress Core

Opened 7 years ago

Last modified 6 months 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: phase-3-media-triage
Focuses: administration Cc:

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.


6 years ago

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


14 months ago

#3 @antpb
14 months ago

  • Keywords phase-3-media-triage added

#4 @pbearne
6 months ago

  • Focuses performance removed

#5 @sabernhardt
6 months ago

a search found about 20 themes that deregistered the styles

Note: See TracTickets for help on using tickets.