Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backport-changelog/7.2/12946.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/12946

* https://github.com/WordPress/gutenberg/pull/81365
1 change: 1 addition & 0 deletions packages/wp-build/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Widgets: carry a widget's declarative `icon` reference from `widget.json`
into the generated PHP registry ([#80969](https://github.com/WordPress/gutenberg/pull/80969)).
- Render a no-JavaScript heading and notice from the generated page templates ([#81365](https://github.com/WordPress/gutenberg/pull/81365)).

### Bug Fixes

Expand Down
9 changes: 9 additions & 0 deletions packages/wp-build/templates/page-wp-admin.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,15 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_wp_admin_render_page() {
}
}
</style>
<div class="wrap hide-if-js">
<h1 class="wp-heading-inline"><?php echo esc_html( get_admin_page_title() ); ?></h1>
<?php
wp_admin_notice(
__( 'This screen requires JavaScript. Enable JavaScript in your browser settings and reload the page.' ),
array( 'type' => 'error' )
);
?>
</div>
<div id="{{PAGE_SLUG}}-wp-admin-app" class="boot-layout-container"></div>
<?php
}
Expand Down
20 changes: 19 additions & 1 deletion packages/wp-build/templates/page.php.template
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,25 @@ function {{PREFIX}}_{{PAGE_SLUG_UNDERSCORE}}_render_page() {
// END see wp-admin/admin-header.php
?>
</head>
<body class="{{PAGE_SLUG}}">
<body class="{{PAGE_SLUG}} no-js">
<?php
// BEGIN see wp-admin/admin-header.php
?>
<script type="text/javascript">
document.body.className = document.body.className.replace( 'no-js', 'js' );
</script>
<?php
// END see wp-admin/admin-header.php
?>
<div class="wrap hide-if-js" style="margin: 20px;">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page builds its own <body> instead of going through admin-header.php, so there is no #wpbody-content to supply the padding that .wrap relies on for its inline-start spacing. Without the inline margin the heading and notice sit flush against the viewport edge.

<h1 class="wp-heading-inline"><?php echo esc_html( get_admin_page_title() ); ?></h1>
<?php
wp_admin_notice(
__( 'This screen requires JavaScript. Enable JavaScript in your browser settings and reload the page.' ),
array( 'type' => 'error' )
);
?>
</div>
<div id="{{PAGE_SLUG}}-app" style="height: 100vh; box-sizing: border-box;"></div>
<?php
// BEGIN see wp-admin/admin-footer.php
Expand Down
Loading