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;
}
.health-check-accordion dt {
font-weight: 600;
.health-check-accordion-heading {
margin: 0;
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;
}

File diff suppressed because one or more lines are too long

View File

@ -271,12 +271,16 @@
border: 1px solid #e2e4e7;
}
.health-check-accordion dt {
font-weight: 600;
.health-check-accordion-heading {
margin: 0;
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;
}

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; ?>
</div>
<dl id="health-check-debug" role="presentation" class="health-check-accordion">
<div id="health-check-debug" class="health-check-accordion">
<?php
foreach ( $info as $section => $details ) {
@ -103,20 +103,20 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
continue;
}
?>
<dt role="heading" aria-level="3">
<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">
<span class="title">
<?php echo esc_html( $details['label'] ); ?>
<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">
<span class="title">
<?php echo esc_html( $details['label'] ); ?>
<?php if ( isset( $details['show_count'] ) && $details['show_count'] ) : ?>
<?php printf( '(%d)', count( $details['fields'] ) ); ?>
<?php endif; ?>
</span>
<?php if ( isset( $details['show_count'] ) && $details['show_count'] ) : ?>
<?php printf( '(%d)', count( $details['fields'] ) ); ?>
<?php endif; ?>
</span>
<span class="icon"></span>
</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
if ( isset( $details['description'] ) && ! empty( $details['description'] ) ) {
printf(
@ -161,9 +161,9 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
</tbody>
</table>
</dd>
</div>
<?php } ?>
</dl>
</div>
</div>
<?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' ); ?>
</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 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' ); ?>
</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>
@ -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' ); ?>
</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>
<script id="tmpl-health-check-issue" type="text/template">
<dt role="heading" aria-level="4">
<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">
<h4 class="health-check-accordion-heading">
<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="badge {{ data.badge.color }}">{{ data.badge.label }}</span>
<span class="icon"></span>
</button>
</dt>
<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">
</h4>
<div id="health-check-accordion-block-{{ data.test }}" class="health-check-accordion-panel" hidden="hidden">
{{{ data.description }}}
<div class="actions">
<p class="button-container">{{{ data.actions }}}</p>
</div>
</dd>
</div>
</script>
<?php

View File

@ -13,7 +13,7 @@
*
* @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.