Skip to content
Closed
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
15 changes: 14 additions & 1 deletion src/js/_enqueues/admin/site-health.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jQuery( function( $ ) {
$( '.health-check-accordion' ).on( 'click', '.health-check-accordion-trigger', function() {
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );

window.location.hash = $( this ).attr( 'id' );

if ( isExpanded ) {
$( this ).attr( 'aria-expanded', 'false' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
Expand All @@ -53,8 +55,19 @@ jQuery( function( $ ) {
}
} );

// Site Health test handling.
// Get hash from query string and open the related accordion.
$( window ).on( 'load', function() {
var hash = window.location.hash;
if ( hash ) {
var requestedPanel = $( hash );
if ( requestedPanel.length ) {
requestedPanel.attr('aria-expanded', 'true');
$( '#' + requestedPanel.attr( 'aria-controls' ) ).attr( 'hidden', false );
}
}
} );

// Site Health test handling.
$( '.site-health-view-passed' ).on( 'click', function() {
var goodIssuesWrapper = $( '#health-check-issues-good' );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/site-health-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

?>
<h3 class="health-check-accordion-heading">
<button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" type="button">
<button id="health-check-section-<?php echo esc_attr( $section ); ?>" aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" type="button">
<span class="title">
<?php echo esc_html( $details['label'] ); ?>
<?php
Expand Down
Loading