Make WordPress Core

Changeset 53950


Ignore:
Timestamp:
08/28/2022 07:15:37 PM (3 years ago)
Author:
Clorith
Message:

Site Health: Don't show issue groups unless there are items in them.

The Site Health Status screen groups issues into the categories good, recommended, and critical when displaying them to the end user.

Initially, this screen would show 0 critical issues while the checks were being performed, and then hide the group if no issues were discovered after all checks had completed, this not being an ideal user experience, as it is a better experience to show areas that have content, instead of hiding them after the fact.

This change makes the groups hidden by default, and also changes the logic to see if a group should be displayed when an item is added to the list (as opposed to the previous approach which only did this check once every single test had completed).

Props DavidAnderson, palmiak.
Fixes #47222.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/site-health.js

    r50766 r53950  
    169169        }
    170170
     171        if ( 0 < parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
     172            $( '#health-check-issues-critical' ).removeClass( 'hidden' );
     173        }
     174        if ( 0 < parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
     175            $( '#health-check-issues-recommended' ).removeClass( 'hidden' );
     176        }
     177
    171178        $( '.issues', '#health-check-issues-' + issue.status ).append( template( issue ) );
    172179    }
     
    211218        $circle.css( { strokeDashoffset: pct } );
    212219
    213         if ( 1 > parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
    214             $( '#health-check-issues-critical' ).addClass( 'hidden' );
    215         }
    216 
    217         if ( 1 > parseInt( SiteHealth.site_status.issues.recommended, 0 ) ) {
    218             $( '#health-check-issues-recommended' ).addClass( 'hidden' );
    219         }
    220 
    221220        if ( 80 <= val && 0 === parseInt( SiteHealth.site_status.issues.critical, 0 ) ) {
    222221            $wrapper.addClass( 'green' ).removeClass( 'orange' );
  • trunk/src/wp-admin/site-health.php

    r52385 r53950  
    234234        </h2>
    235235
    236         <p><?php _e( 'The site health check shows critical information about your WordPress configuration and items that require your attention.' ); ?></p>
    237 
    238         <div class="site-health-issues-wrapper" id="health-check-issues-critical">
     236        <p><?php _e( 'The site health check shows information about your WordPress configuration and items that may need your attention.' ); ?></p>
     237
     238        <div class="site-health-issues-wrapper hidden" id="health-check-issues-critical">
    239239            <h3 class="site-health-issue-count-title">
    240240                <?php
     
    244244            </h3>
    245245
     246            <p><?php _e( 'Critical issues are items that may have a high impact on your sites performance or security, and resolving these issues should be prioritized.' ); ?></p>
     247
    246248            <div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
    247249        </div>
    248250
    249         <div class="site-health-issues-wrapper" id="health-check-issues-recommended">
     251        <div class="site-health-issues-wrapper hidden" id="health-check-issues-recommended">
    250252            <h3 class="site-health-issue-count-title">
    251253                <?php
     
    254256                ?>
    255257            </h3>
     258
     259            <p><?php _e( 'Recommended items are considered beneficial to your site, although not as important to prioritize as a critical issue, they may include improvements to things such as; Performance, user experience, and more.' ); ?></p>
    256260
    257261            <div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
Note: See TracChangeset for help on using the changeset viewer.