Site Health: Add a unique wrapper for dashboard widget content.

This wraps the inner-content of the Site Health dashboard widget to give a unique target for CSS selectors, restoring the ability to collapse the widget.

The initial implementation targeted the `.inside` class used by all widgets to apply styling to the widget content, but this prevented the widget from being collapsed, as it added grid-styles which other widgets do not use, overriding the usual behavior when toggling widget visibility.

Follow-up to [50833].

Props alanjacobmathew, walbo.
Fixes #53521.
Built from https://develop.svn.wordpress.org/trunk@51247


git-svn-id: http://core.svn.wordpress.org/trunk@50856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Clorith 2021-06-27 15:56:58 +00:00
parent d18f86031a
commit c26143ea2e
6 changed files with 63 additions and 61 deletions

View File

@ -307,7 +307,7 @@ are styled in the Privacy section of edit.css */
padding-right: 16px;
}
#dashboard_site_health .inside {
#dashboard_site_health .health-check-widget {
display: grid;
grid-template-columns: 1fr 2fr;
grid-auto-rows: minmax(64px, auto);
@ -319,7 +319,7 @@ are styled in the Privacy section of edit.css */
}
@media screen and (max-width: 480px) {
#dashboard_site_health .inside {
#dashboard_site_health .health-check-widget {
grid-template-columns: 100%;
}
}

File diff suppressed because one or more lines are too long

View File

@ -306,7 +306,7 @@ are styled in the Privacy section of edit.css */
padding-left: 16px;
}
#dashboard_site_health .inside {
#dashboard_site_health .health-check-widget {
display: grid;
grid-template-columns: 1fr 2fr;
grid-auto-rows: minmax(64px, auto);
@ -318,7 +318,7 @@ are styled in the Privacy section of edit.css */
}
@media screen and (max-width: 480px) {
#dashboard_site_health .inside {
#dashboard_site_health .health-check-widget {
grid-template-columns: 100%;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1909,67 +1909,69 @@ function wp_dashboard_site_health() {
$issues_total = $issue_counts['recommended'] + $issue_counts['critical'];
?>
<div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
<div class="site-health-progress">
<svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
<circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
</svg>
<div class="health-check-widget">
<div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
<div class="site-health-progress">
<svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
<circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
</svg>
</div>
<div class="site-health-progress-label">
<?php if ( false === $get_issues ) : ?>
<?php _e( 'No information yet&hellip;' ); ?>
<?php else : ?>
<?php _e( 'Results are still loading&hellip;' ); ?>
<?php endif; ?>
</div>
</div>
<div class="site-health-progress-label">
<div class="site-health-details">
<?php if ( false === $get_issues ) : ?>
<?php _e( 'No information yet&hellip;' ); ?>
<p>
<?php
printf(
/* translators: %s: URL to Site Health screen. */
__( 'Site health checks will automatically run periodically to gather information about your site. You can also <a href="%s">visit the Site Health screen</a> to gather information about your site now.' ),
esc_url( admin_url( 'site-health.php' ) )
);
?>
</p>
<?php else : ?>
<?php _e( 'Results are still loading&hellip;' ); ?>
<p>
<?php if ( $issues_total <= 0 ) : ?>
<?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
<?php elseif ( 1 === (int) $issue_counts['critical'] ) : ?>
<?php _e( 'Your site has a critical issue that should be addressed as soon as possible to improve its performance and security.' ); ?>
<?php elseif ( $issue_counts['critical'] > 1 ) : ?>
<?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve its performance and security.' ); ?>
<?php elseif ( 1 === (int) $issue_counts['recommended'] ) : ?>
<?php _e( 'Your site&#8217;s health is looking good, but there is still one thing you can do to improve its performance and security.' ); ?>
<?php else : ?>
<?php _e( 'Your site&#8217;s health is looking good, but there are still some things you can do to improve its performance and security.' ); ?>
<?php endif; ?>
</p>
<?php endif; ?>
<?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
<p>
<?php
printf(
/* translators: 1: Number of issues. 2: URL to Site Health screen. */
_n(
'Take a look at the <strong>%1$d item</strong> on the <a href="%2$s">Site Health screen</a>.',
'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health screen</a>.',
$issues_total
),
$issues_total,
esc_url( admin_url( 'site-health.php' ) )
);
?>
</p>
<?php endif; ?>
</div>
</div>
<div class="site-health-details">
<?php if ( false === $get_issues ) : ?>
<p>
<?php
printf(
/* translators: %s: URL to Site Health screen. */
__( 'Site health checks will automatically run periodically to gather information about your site. You can also <a href="%s">visit the Site Health screen</a> to gather information about your site now.' ),
esc_url( admin_url( 'site-health.php' ) )
);
?>
</p>
<?php else : ?>
<p>
<?php if ( $issues_total <= 0 ) : ?>
<?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
<?php elseif ( 1 === (int) $issue_counts['critical'] ) : ?>
<?php _e( 'Your site has a critical issue that should be addressed as soon as possible to improve its performance and security.' ); ?>
<?php elseif ( $issue_counts['critical'] > 1 ) : ?>
<?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve its performance and security.' ); ?>
<?php elseif ( 1 === (int) $issue_counts['recommended'] ) : ?>
<?php _e( 'Your site&#8217;s health is looking good, but there is still one thing you can do to improve its performance and security.' ); ?>
<?php else : ?>
<?php _e( 'Your site&#8217;s health is looking good, but there are still some things you can do to improve its performance and security.' ); ?>
<?php endif; ?>
</p>
<?php endif; ?>
<?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
<p>
<?php
printf(
/* translators: 1: Number of issues. 2: URL to Site Health screen. */
_n(
'Take a look at the <strong>%1$d item</strong> on the <a href="%2$s">Site Health screen</a>.',
'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health screen</a>.',
$issues_total
),
$issues_total,
esc_url( admin_url( 'site-health.php' ) )
);
?>
</p>
<?php endif; ?>
</div>
<?php
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-beta4-51246';
$wp_version = '5.8-beta4-51247';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.