From 13a3c4c7f4c0d7e1da13edaf690dabe587ce9d80 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Fri, 19 Aug 2022 22:05:00 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@53912 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/embed.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php index 2710f392c7..443d399217 100644 --- a/src/wp-includes/embed.php +++ b/src/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; ?>