Skip to content

Commit 4599605

Browse files
committed
Customize: Accessibility: Restore heading semantics in sections.
Remove `role="presentation"` from headings in the customizer. These were needed to avoid confusing semantics when the headings also acted as buttons to control accordions, changed in [59924]. Change responsive CSS to use `screen-reader-text` styling rather than `display: none` so that mobile retains the headings hierarchy. Props joedolson, hbhalodia, mikinc860, guillaumeturpin, rcreators, tirth03, dhrumilk . Fixes #62215. git-svn-id: https://develop.svn.wordpress.org/trunk@59825 602fd350-edb4-49c9-b593-d223f7449a82
1 parent deec0a0 commit 4599605

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

src/wp-admin/css/customize-controls.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@ body.trashing #publish-settings {
447447
#customize-controls .customize-info .preview-notice {
448448
font-size: 13px;
449449
line-height: 1.9;
450+
margin: 0;
451+
font-weight: 400;
452+
color: #50575e;
450453
}
451454

452455
#customize-controls .customize-pane-child .customize-section-title h3,
@@ -2641,6 +2644,19 @@ body.adding-widget .add-new-widget:before,
26412644

26422645
#available-widgets .customize-section-title,
26432646
#available-menu-items .customize-section-title {
2647+
border: 0;
2648+
clip-path: inset(50%);
2649+
height: 1px;
2650+
margin: -1px;
2651+
overflow: hidden;
2652+
padding: 0;
2653+
position: absolute;
2654+
width: 1px;
2655+
word-wrap: normal !important;
2656+
}
2657+
2658+
#available-widgets .customize-section-title button,
2659+
#available-menu-items .customize-section-title button {
26442660
display: none;
26452661
}
26462662

@@ -2977,8 +2993,19 @@ body.adding-widget .add-new-widget:before,
29772993

29782994
#available-widgets .customize-section-title,
29792995
#available-menu-items .customize-section-title {
2980-
display: block;
2996+
border: 0;
2997+
clip-path: none;
2998+
height: inherit;
29812999
margin: 0;
3000+
overflow: hidden;
3001+
padding: 0;
3002+
width: auto;
3003+
position: static;
3004+
}
3005+
3006+
#available-widgets .customize-section-title button,
3007+
#available-menu-items .customize-section-title button {
3008+
display: block;
29823009
}
29833010

29843011
#available-widgets .customize-section-back,

src/wp-admin/customize.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,12 @@
233233
<div class="wp-full-overlay-sidebar-content" tabindex="-1">
234234
<div id="customize-info" class="accordion-section customize-info" data-block-theme="<?php echo (int) wp_is_block_theme(); ?>">
235235
<div class="accordion-section-title">
236-
<span class="preview-notice">
236+
<h2 class="preview-notice">
237237
<?php
238238
/* translators: %s: The site/panel title in the Customizer. */
239239
printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
240240
?>
241-
</span>
241+
</h2>
242242
<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text">
243243
<?php
244244
/* translators: Hidden accessibility text. */

src/wp-includes/class-wp-customize-nav-menus.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ protected function print_post_type_container( $available_item_type ) {
12221222
$id = sprintf( 'available-menu-items-%s-%s', $available_item_type['type'], $available_item_type['object'] );
12231223
?>
12241224
<div id="<?php echo esc_attr( $id ); ?>" class="accordion-section">
1225-
<h4 class="accordion-section-title" role="presentation">
1225+
<h4 class="accordion-section-title">
12261226
<button type="button" class="accordion-trigger" aria-expanded="false" aria-controls="<?php echo esc_attr( $id ); ?>-content">
12271227
<?php echo esc_html( $available_item_type['title'] ); ?>
12281228
<span class="spinner"></span>
@@ -1257,7 +1257,7 @@ protected function print_post_type_container( $available_item_type ) {
12571257
protected function print_custom_links_available_menu_item() {
12581258
?>
12591259
<div id="new-custom-menu-item" class="accordion-section">
1260-
<h4 class="accordion-section-title" role="presentation">
1260+
<h4 class="accordion-section-title">
12611261
<button type="button" class="accordion-trigger" aria-expanded="false" aria-controls="new-custom-menu-item-content">
12621262
<?php _e( 'Custom Links' ); ?>
12631263
<span class="toggle-indicator" aria-hidden="true"></span>

0 commit comments

Comments
 (0)