[wp-trac] [WordPress Trac] #40225: Using wp_enqueue_style() with 'admin_enqueue_scripts' results in unresponsive "Screen Options" button

WordPress Trac noreply at wordpress.org
Wed Mar 22 00:32:07 UTC 2017


#40225: Using wp_enqueue_style() with 'admin_enqueue_scripts' results in
unresponsive "Screen Options" button
-------------------------------+------------------------------
 Reporter:  shastjion          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Script Loader      |     Version:  4.7.3
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  ui, javascript
-------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => reporter-feedback
 * focuses:  ui, accessibility, javascript => ui, javascript
 * component:  General => Script Loader


Comment:

 Hi @shastjion, welcome to WordPress Trac! Thanks for the report.

 `wp_enqueue_style()` by itself should not cause any issues with "Screen
 Options" button, so I think there might be a CSS or JS conflict with the
 particular styles you're using.

 * Could you share the contents of `library/css/style.css` file?
 * Does it still happen on a clean install with all plugins disabled and a
 default theme (Twenty Seventeen) activated?

 > Using wp_enqueue_script() results in both the .css file and the other js
 being loaded correctly:
 > {{{
 > function load_admin_style() {
 >   wp_enqueue_script('admin_css', get_template_directory_uri() .
 '/library/css/style.css');
 > }
 > add_action( 'admin_enqueue_scripts', 'load_admin_style' );
 > }}}

 Note that the usage of `wp_enqueue_script()` is invalid here, as you're
 loading a CSS file in a `<script>` tag.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40225#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list