From 4e02973bc1ec7107184a8a8c04e51ac0e3191510 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Sat, 23 Feb 2019 18:31:05 +0000 Subject: [PATCH] Accessibility: Improve the image and gallery widgets preview accessibility. In an authoring context, the image `alt` attribute purpose is different from the one for the front end. For example, screen reader users need to know what the selected image is, even when the original `alt` value is empty. This change introduces a new pattern for the `alt` text in an authoring context: - uses the `alt` text if not empty - when there's no `alt` text, informs users the image has no alternative text and provides a reference to the image filename Also, makes the gallery media widget preview an unordered list to make screen readers announce the number of images automatically. Fixes #43137. git-svn-id: https://develop.svn.wordpress.org/trunk@44767 602fd350-edb4-49c9-b593-d223f7449a82 --- .../widgets/class-wp-widget-media-gallery.php | 53 +++++++++++++------ .../widgets/class-wp-widget-media-image.php | 25 +++++---- 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/wp-includes/widgets/class-wp-widget-media-gallery.php b/src/wp-includes/widgets/class-wp-widget-media-gallery.php index 12f39e6aa9..54cea50ad9 100644 --- a/src/wp-includes/widgets/class-wp-widget-media-gallery.php +++ b/src/wp-includes/widgets/class-wp-widget-media-gallery.php @@ -175,34 +175,57 @@ class WP_Widget_Media_Gallery extends WP_Widget_Media { parent::render_control_template_scripts(); ?>