Description
Description
When a classic theme adds the theme support for editor-styles, a menu item called "Design" replaces the Pattern menu, and following this link shows the dark sidebar and an iframe with the site embedded.
The preview of the front of the site replaces the preview of the editor that is shown for block themes.
Many themes may load custom JavaScript, potentially causing errors on this screen.
For example, the theme Hello Elementor adds JavaScript for their admin notice, and there is a console error.
How can themes detect that the user is viewing this screen, and prevent loading JavaScript that is meant for other admin pages?
It does not seem possible with https://developer.wordpress.org/reference/functions/get_current_screen/
Step-by-step reproduction instructions
Activate a classic theme with support for editor-styles.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure