[wp-trac] [WordPress Trac] #43137: Media widgets: Improve the image and gallery previews accessibility

WordPress Trac noreply at wordpress.org
Thu Feb 21 20:30:29 UTC 2019


#43137: Media widgets: Improve the image and gallery previews accessibility
---------------------------------------+----------------------------
 Reporter:  afercia                    |       Owner:  afercia
     Type:  defect (bug)               |      Status:  reviewing
 Priority:  normal                     |   Milestone:  5.2
Component:  Widgets                    |     Version:  4.9
 Severity:  normal                     |  Resolution:
 Keywords:  has-screenshots has-patch  |     Focuses:  accessibility
---------------------------------------+----------------------------
Changes (by afercia):

 * keywords:  has-screenshots has-patch needs-refresh => has-screenshots
     has-patch


Old description:

> Context: in the front-end, the image alt attribute must describe the
> purpose of the image or must be empty if the image is not a key part of
> the content and is purely decorative.
>
> Instead, in the admin screens we're in an editing context. As a user,
> while authoring content, I need to know what the image is, regardless if
> the image has or has not an alternative text.
>
> The image widget preview already does something to always provide some
> info about the image. When the image has no alternative text, it uses an
> `aria-describedby` attribute pointing to a hidden element that contains
> some info about the image file name:
>
> [[Image(https://cldup.com/uoRHlQWnmn.jpg)]]
>
> Pretty smart. Without this the image wouldn't provide any useful
> information to assistive technologies and users wouldn't have any clue
> what the image is about. It can be improved a bit, as the proper way to
> give an accessible name to an image is using an `aria-label` or `aria-
> labelledby` attribute, not an `aria-describedby` attribute.
>
> Instead, the preview of the new gallery widget introduced in WordPress
> 4.9 always prints out an empty alt attribute `alt=""` for all the images.
> Worth reminding images with an empty alt attribute are completely ignored
> by assistive technologies. When navigating through the preview, the only
> information provided is the textual content for the "more images" text
> (it appears only when the gallery contains more than 6 images). Also,
> each image is within a `<dl>` element, that doesn't give any useful
> information to users:
>
> [[Image(https://cldup.com/m07kUdxgho.jpg)]]
>
> [[Image(https://cldup.com/PYrQBKhoAB.jpg)]]
>
> [[Image(https://cldup.com/wKboHchwkB.jpg)]]
>
> I'd like to propose to use the same pattern used for the Image preview,
> and provide some extra info for each image in the gallery. Also, as a
> user I'd like to know how many images are displayed in the preview: using
> an unordered list with each image in a `<li>` element would make
> assistive technologies announce that automatically.

New description:

 Context: in the front-end, the image alt attribute must describe the
 purpose of the image or must be empty if the image is not a key part of
 the content and is purely decorative.

 Instead, in the admin screens we're in an editing context. As an user,
 while authoring content, I need to know what the image is, regardless if
 the image has or has not an alternative text.

 The image widget preview already does something to always provide some
 info about the image. When the image has no alternative text, it uses an
 `aria-describedby` attribute pointing to a hidden element that contains
 info about the image filename:

 [[Image(https://cldup.com/uoRHlQWnmn.jpg)]]

 Pretty smart. Without this, the image wouldn't provide any useful
 information to assistive technologies and users wouldn't have any clue
 what the image is about. It can be improved a bit, as the proper way to
 give an accessible name to an image is by using an `aria-label` or `aria-
 labelledby` attribute, not an `aria-describedby` attribute.

 Instead, the preview of the new gallery widget introduced in WordPress 4.9
 always prints out an empty alt attribute `alt=""` for all the images.
 Worth reminding images with an empty alt attribute are completely ignored
 by assistive technologies. When navigating through the preview, the only
 information provided is the textual content for the "more images" text (it
 appears only when the gallery contains more than 6 images). Also, each
 image is within a `<dl>` element, that doesn't give any useful information
 to users:

 [[Image(https://cldup.com/m07kUdxgho.jpg)]]

 [[Image(https://cldup.com/PYrQBKhoAB.jpg)]]

 [[Image(https://cldup.com/wKboHchwkB.jpg)]]

 I'd like to propose to use the same pattern used for the Image preview,
 and provide some extra info for each image in the gallery. Also, as a user
 I'd like to know how many images are displayed in the preview. Using an
 unordered list with each image in a `<li>` element would make assistive
 technologies announce that automatically.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43137#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list