File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ jQuery( function( $ ) {
4444 $ ( '.health-check-accordion' ) . on ( 'click' , '.health-check-accordion-trigger' , function ( ) {
4545 var isExpanded = ( 'true' === $ ( this ) . attr ( 'aria-expanded' ) ) ;
4646
47+ window . location . hash = $ ( this ) . attr ( 'id' ) ;
48+
4749 if ( isExpanded ) {
4850 $ ( this ) . attr ( 'aria-expanded' , 'false' ) ;
4951 $ ( '#' + $ ( this ) . attr ( 'aria-controls' ) ) . attr ( 'hidden' , true ) ;
@@ -53,6 +55,19 @@ jQuery( function( $ ) {
5355 }
5456 } ) ;
5557
58+ // Get hash from query string and open the related accordion.
59+ setTimeout ( function ( ) {
60+ var hash = window . location . hash ;
61+
62+ if ( hash ) {
63+ var requestedPanel = $ ( hash ) ;
64+
65+ if ( requestedPanel . length ) {
66+ requestedPanel . trigger ( 'click' ) ;
67+ }
68+ }
69+ } , 100 ) ;
70+
5671 // Site Health test handling.
5772
5873 $ ( '.site-health-view-passed' ) . on ( 'click' , function ( ) {
Original file line number Diff line number Diff line change 7373
7474 ?>
7575 <h3 class="health-check-accordion-heading">
76- <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr ( $ section ); ?> " type="button">
76+ <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">
7777 <span class="title">
7878 <?php echo esc_html ( $ details ['label ' ] ); ?>
7979 <?php
Original file line number Diff line number Diff line change 301301
302302<script id="tmpl-health-check-issue" type="text/template">
303303 <h4 class="health-check-accordion-heading">
304- <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" type="button">
304+ <button id="health-check-section-{{ data.test }}" aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" type="button">
305305 <span class="title">{{ data.label }}</span>
306306 <# if ( data.badge ) { #>
307307 <span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
You can’t perform that action at this time.
0 commit comments