From 806336ce27711df5d952e63b3da0ede16803ced8 Mon Sep 17 00:00:00 2001 From: joedolson Date: Fri, 19 Aug 2022 23:06:09 +0000 Subject: [PATCH] Taxonomy: Associate field descriptions with fields. Use `aria-describedby` to associate the field descriptions and instructions with the form fields when creating or editing taxonomy terms. Props afercia. Fixes #55651. Built from https://develop.svn.wordpress.org/trunk@53913 git-svn-id: http://core.svn.wordpress.org/trunk@53472 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-tag-form.php | 17 +++++++++-------- wp-admin/edit-tags.php | 18 ++++++++++-------- wp-includes/category-template.php | 8 +++++++- wp-includes/version.php | 2 +- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php index 7c22cf471d..9b2110398c 100644 --- a/wp-admin/edit-tag-form.php +++ b/wp-admin/edit-tag-form.php @@ -145,8 +145,8 @@ if ( isset( $tag->name ) ) { - + @@ -167,8 +167,8 @@ if ( isset( $tag->name ) ) { */ $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; ?> - + @@ -186,6 +186,7 @@ if ( isset( $tag->name ) ) { 'exclude_tree' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __( 'None' ), + 'aria_describedby' => 'parent-description', ); /** This filter is documented in wp-admin/edit-tags.php */ @@ -193,17 +194,17 @@ if ( isset( $tag->name ) ) { wp_dropdown_categories( $dropdown_args ); ?> -

+

-

labels->parent_field_description; ?>

+

labels->parent_field_description; ?>

- + - -

labels->name_field_description; ?>

+ +

labels->name_field_description; ?>

- -

labels->slug_field_description; ?>

+ +

labels->slug_field_description; ?>

@@ -500,19 +500,21 @@ if ( $can_edit_terms ) { */ $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); + $dropdown_args['aria_describedby'] = 'parent-description'; + wp_dropdown_categories( $dropdown_args ); ?> -

+

-

labels->parent_field_description; ?>

+

labels->parent_field_description; ?>

- -

labels->desc_field_description; ?>

+ +

labels->desc_field_description; ?>

-1, 'value_field' => 'term_id', 'required' => false, + 'aria_describedby' => '', ); $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; @@ -406,8 +410,10 @@ function wp_dropdown_categories( $args = '' ) { $id = $parsed_args['id'] ? esc_attr( $parsed_args['id'] ) : $name; $required = $parsed_args['required'] ? 'required' : ''; + $aria_describedby_attribute = $parsed_args['aria_describedby'] ? ' aria-describedby="' . esc_attr( $parsed_args['aria_describedby'] ) . '"' : ''; + if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) { - $output = "\n"; } else { $output = ''; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2c975f6aa6..72e643eee6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53912'; +$wp_version = '6.1-alpha-53913'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.