id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 54090,block editor styles enqueued during ajax requests,mnelson4,,"Block editor styles (like `wp-includes/css/dist/block-library/editor.css` and `admin/css/common.min.css`) are getting enqueued during WP ajax requests when a custom block is registered with an ""editor_style"" whose dependencies include ""wp-edit-blocks"". This is a problem because AJAX requests are usually expected to be treated like front-end requests, or at least NOT like a block editor page; and this affects plugins/themes where the themes enqueued during an AJAX request matter. For example, my plugin Print My Blog compiles a ton of posts into a single HTML page and temporarily writes it to the server. I send one or more AJAX requests to generate this HTML page (sometimes it can contain thousands of posts, so I can't always do it in a single request). Each request writes to wp-uploads temporarily. It usually works just fine. Plus, so far it usually enqueued the same CSS and JS as a regular frontend request. But if there is another plugin that registers a custom block like this... {{{#!php 'yarpp-block-style', // <-- style is used for editing the block 'render_callback' => array( $this, 'yarpp_block_render_callback' ) ... ); }}} (that example is from YARPP, but there's a similar block in WooCommerce for example, so it seems pretty standard) ...then the AJAX request gets `admin/css/common.min.css` `wp-includes/css/dist/block-library/editor.css` enqueued so my plugin generates the HTML page with a bunch of styles intended for the admin. This means, for example, the page suddenly has a gray background (like in the admin), and different font sizes, among other styles. It seems buggy that block editor styles and scripts are enqueued during AJAX requests. I understand this doesn't usually matter because they're usually they're not used. But in the case of my plugin, and any other plugin that might use the enqueued styles and scripts during a AJAX request, it creates a bit of a problem. I would expect block editor styles and scripts would only be enqueued on admin pages that actually use the block editor. Here's a short video demonstrating the issue: https://drive.google.com/file/d/1GbjRFlpkuVz7kZWyGiVw0bLZ3Bt1rCsv/view Does that make sense? ",defect (bug),closed,normal,,Script Loader,,normal,duplicate,,,"javascript, css"