Accessibility: Improve the Site Health accordions.

- removes the definition list and uses the markup from the ARIA Authoring Practices example
- removes incorrect ARIA roles
- avoids ARIA landmark regions proliferation

Props mukesh27 for the initial patch.
Fixes #46714.

Built from https://develop.svn.wordpress.org/trunk@45087


git-svn-id: http://core.svn.wordpress.org/trunk@44896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2019-04-01 15:08:58 +00:00
parent 95541a86ff
commit d8b8994336
7 changed files with 38 additions and 30 deletions

View File

@ -271,12 +271,16 @@
border: 1px solid #e2e4e7; border: 1px solid #e2e4e7;
} }
.health-check-accordion dt { .health-check-accordion-heading {
font-weight: 600; margin: 0;
border-top: 1px solid #e2e4e7; border-top: 1px solid #e2e4e7;
font-size: inherit;
line-height: inherit;
font-weight: 600;
color: inherit;
} }
.health-check-accordion dt:first-child { .health-check-accordion-heading:first-child {
border-top: none; border-top: none;
} }

File diff suppressed because one or more lines are too long

View File

@ -271,12 +271,16 @@
border: 1px solid #e2e4e7; border: 1px solid #e2e4e7;
} }
.health-check-accordion dt { .health-check-accordion-heading {
font-weight: 600; margin: 0;
border-top: 1px solid #e2e4e7; border-top: 1px solid #e2e4e7;
font-size: inherit;
line-height: inherit;
font-weight: 600;
color: inherit;
} }
.health-check-accordion dt:first-child { .health-check-accordion-heading:first-child {
border-top: none; border-top: none;
} }

File diff suppressed because one or more lines are too long

View File

@ -95,7 +95,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<?php endif; ?> <?php endif; ?>
</div> </div>
<dl id="health-check-debug" role="presentation" class="health-check-accordion"> <div id="health-check-debug" class="health-check-accordion">
<?php <?php
foreach ( $info as $section => $details ) { foreach ( $info as $section => $details ) {
@ -103,20 +103,20 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
continue; continue;
} }
?> ?>
<dt role="heading" aria-level="3"> <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 ); ?>" id="health-check-accordion-heading-<?php echo esc_attr( $section ); ?>" type="button"> <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" type="button">
<span class="title"> <span class="title">
<?php echo esc_html( $details['label'] ); ?> <?php echo esc_html( $details['label'] ); ?>
<?php if ( isset( $details['show_count'] ) && $details['show_count'] ) : ?> <?php if ( isset( $details['show_count'] ) && $details['show_count'] ) : ?>
<?php printf( '(%d)', count( $details['fields'] ) ); ?> <?php printf( '(%d)', count( $details['fields'] ) ); ?>
<?php endif; ?> <?php endif; ?>
</span> </span>
<span class="icon"></span> <span class="icon"></span>
</button> </button>
</dt> </h3>
<dd id="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" role="region" aria-labelledby="health-check-accordion-heading-<?php echo esc_attr( $section ); ?>" class="health-check-accordion-panel" hidden="hidden"> <div id="health-check-accordion-block-<?php echo esc_attr( $section ); ?>" class="health-check-accordion-panel" hidden="hidden">
<?php <?php
if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) { if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) {
printf( printf(
@ -161,9 +161,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
?> ?>
</tbody> </tbody>
</table> </table>
</dd> </div>
<?php } ?> <?php } ?>
</dl> </div>
</div> </div>
<?php <?php

View File

@ -92,7 +92,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?> <span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>
</h3> </h3>
<dl id="health-check-site-status-critical" role="presentation" class="health-check-accordion issues"></dl> <div id="health-check-site-status-critical" class="health-check-accordion issues"></div>
</div> </div>
<div class="site-health-issues-wrapper" id="health-check-issues-recommended"> <div class="site-health-issues-wrapper" id="health-check-issues-recommended">
@ -100,7 +100,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<span class="issue-count">0</span> <?php _e( 'Recommended improvements' ); ?> <span class="issue-count">0</span> <?php _e( 'Recommended improvements' ); ?>
</h3> </h3>
<dl id="health-check-site-status-recommended" role="presentation" class="health-check-accordion issues"></dl> <div id="health-check-site-status-recommended" class="health-check-accordion issues"></div>
</div> </div>
</div> </div>
@ -115,24 +115,24 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<span class="issue-count">0</span> <?php _e( 'Items with no issues detected' ); ?> <span class="issue-count">0</span> <?php _e( 'Items with no issues detected' ); ?>
</h3> </h3>
<dl id="health-check-site-status-good" role="presentation" class="health-check-accordion issues"></dl> <div id="health-check-site-status-good" class="health-check-accordion issues"></div>
</div> </div>
</div> </div>
<script id="tmpl-health-check-issue" type="text/template"> <script id="tmpl-health-check-issue" type="text/template">
<dt role="heading" aria-level="4"> <h4 class="health-check-accordion-heading">
<button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" id="health-check-accordion-heading-{{ data.test }}" type="button"> <button aria-expanded="false" class="health-check-accordion-trigger" aria-controls="health-check-accordion-block-{{ data.test }}" type="button">
<span class="title">{{ data.label }}</span> <span class="title">{{ data.label }}</span>
<span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span> <span class="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
<span class="icon"></span> <span class="icon"></span>
</button> </button>
</dt> </h4>
<dd id="health-check-accordion-block-{{ data.test }}" aria-labelledby="health-check-accordion-heading-{{ data.test }}" role="region" class="health-check-accordion-panel" hidden="hidden"> <div id="health-check-accordion-block-{{ data.test }}" class="health-check-accordion-panel" hidden="hidden">
{{{ data.description }}} {{{ data.description }}}
<div class="actions"> <div class="actions">
<p class="button-container">{{{ data.actions }}}</p> <p class="button-container">{{{ data.actions }}}</p>
</div> </div>
</dd> </div>
</script> </script>
<?php <?php

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2-beta1-45086'; $wp_version = '5.2-beta1-45087';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.