From 82f3535083c0d8859bd3b8333fe006394978c09e Mon Sep 17 00:00:00 2001 From: joedolson Date: Fri, 19 Aug 2022 22:06:09 +0000 Subject: [PATCH] Embeds: Fix missing labels and duplicate IDs. Add `aria-label` and `aria-describedby` to provide embed form fields with accessible names and ensure each embed has a unique ID attribute to prevent duplicate IDs. Props afercia, swissspidy. Fixes #55664. Built from https://develop.svn.wordpress.org/trunk@53912 git-svn-id: http://core.svn.wordpress.org/trunk@53471 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/embed.php | 22 ++++++++++++++-------- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 2710f392c7..443d399217 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -1151,29 +1151,35 @@ function print_embed_sharing_dialog() { if ( is_404() ) { return; } + + $unique_suffix = get_the_ID() . '-' . wp_rand(); + $share_tab_wordpress_id = 'wp-embed-share-tab-wordpress-' . $unique_suffix; + $share_tab_html_id = 'wp-embed-share-tab-html-' . $unique_suffix; + $description_wordpress_id = 'wp-embed-share-description-wordpress-' . $unique_suffix; + $description_html_id = 'wp-embed-share-description-html-' . $unique_suffix; ?>