Skip to content

Commit aef1cb9

Browse files
committed
Editor: Add no-js fallback for site editor.
Add a fallback condition with heading and error notice to handle a no JavaScript state for the site editor, comparable to what already exists in the post editor. Props afercia, joedolson, fencermonir, zebaafiashama, alexstine, rudlinkon. Fixes #56228. git-svn-id: https://develop.svn.wordpress.org/trunk@56025 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ba4ada5 commit aef1cb9

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/wp-admin/css/common.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,8 @@ code {
573573
margin: 10px 20px 0 2px;
574574
}
575575

576-
.wrap.block-editor-no-js {
576+
.wrap.block-editor-no-js,
577+
.wrap.site-editor-no-js {
577578
padding-left: 20px;
578579
}
579580

src/wp-admin/site-editor.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,30 @@ static function( $classes ) {
132132
require_once ABSPATH . 'wp-admin/admin-header.php';
133133
?>
134134

135-
<div id="site-editor" class="edit-site"></div>
135+
<div class="edit-site">
136+
<div id="site-editor"></div>
137+
138+
<?php // JavaScript is disabled. ?>
139+
<div class="wrap hide-if-js site-editor-no-js">
140+
<h1 class="wp-heading-inline"><?php _e( 'Edit site' ); ?></h1>
141+
<div class="notice notice-error notice-alt">
142+
<p>
143+
<?php
144+
/**
145+
* Filters the message displayed in the site editor interface when JavaScript is
146+
* not enabled in the browser.
147+
*
148+
* @since 6.3.0
149+
*
150+
* @param string $message The message being displayed.
151+
* @param WP_Post $post The post being edited.
152+
*/
153+
echo apply_filters( 'site_editor_no_javascript_message', __( 'The site editor requires JavaScript. Please enable JavaScript in your browser settings.' ), $post );
154+
?>
155+
</p>
156+
</div>
157+
</div>
158+
</div>
136159

137160
<?php
138161

0 commit comments

Comments
 (0)