Skip to content

Commit e4cb98d

Browse files
committed
Administration: Add no-JS fallbacks to route-based pages.
The Fonts and Connectors screens are rendered entirely by JavaScript, so they were completely empty when JavaScript is disabled. Both screens now render the page heading and an error notice, shown only when JavaScript is unavailable. Props afercia, hbhalodia, wildworks. Fixes #65690. git-svn-id: https://develop.svn.wordpress.org/trunk@62954 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5313494 commit e4cb98d

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

‎src/wp-admin/font-library.php‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,26 @@
2828
}
2929

3030
// Set the page title
31-
$title = _x( 'Fonts', 'Font Library admin page title' );
31+
$title = _x( 'Fonts', 'Font Library admin page title' );
32+
$js_required_message = __( 'The Fonts screen requires JavaScript. Please enable JavaScript in your browser settings to install and manage fonts.' );
3233

3334
require_once ABSPATH . 'wp-admin/admin-header.php';
3435

36+
?>
37+
<div class="wrap hide-if-js">
38+
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
39+
<?php
40+
wp_admin_notice(
41+
$js_required_message,
42+
array(
43+
'type' => 'error',
44+
'additional_classes' => array( 'hide-if-js' ),
45+
)
46+
);
47+
?>
48+
</div>
49+
<?php
50+
3551
// Render the Font Library page
3652
wp_font_library_wp_admin_render_page();
3753

‎src/wp-admin/options-connectors.php‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,29 @@
2727
}
2828

2929
// Set the page title.
30-
$title = __( 'Connectors' );
30+
$title = __( 'Connectors' );
31+
$js_required_message = __( 'The Connectors screen requires JavaScript. Please enable JavaScript in your browser settings to manage your connectors.' );
3132

3233
// Set parent file for menu highlighting.
3334
$parent_file = 'options-general.php';
3435

3536
require_once ABSPATH . 'wp-admin/admin-header.php';
3637

38+
?>
39+
<div class="wrap hide-if-js">
40+
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
41+
<?php
42+
wp_admin_notice(
43+
$js_required_message,
44+
array(
45+
'type' => 'error',
46+
'additional_classes' => array( 'hide-if-js' ),
47+
)
48+
);
49+
?>
50+
</div>
51+
<?php
52+
3753
// Render the Connectors page.
3854
wp_options_connectors_wp_admin_render_page();
3955

0 commit comments

Comments
 (0)