[wp-trac] [WordPress Trac] #50273: Media modal uses incorrect 'checkbox' role for list items

WordPress Trac noreply at wordpress.org
Thu May 28 04:40:11 UTC 2020


#50273: Media modal uses incorrect 'checkbox' role for list items
---------------------------+-----------------------------
 Reporter:  talldanwp      |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Media          |    Version:
 Severity:  normal         |   Keywords:
  Focuses:  accessibility  |
---------------------------+-----------------------------
 The media modal uses the role of 'checkbox' on list items (`<li>`) when
 selecting media (e.g. to add to a gallery.)

 The specification of a role here is overriding the list item element's
 implicit `listitem` role.

 The list item elements in this case should ideally have no `role`
 specified. The element with a checkbox role should be a child element of
 the list item and other associated attributes like `aria-checked` should
 also be moved to that element.

 For context, this issue was caught by the automated Axe tests when writing
 an end-to-end test for the block editor:
 https://github.com/WordPress/gutenberg/pull/22659#discussion_r431036627

 To reproduce:
 1. Ensure some images are uploaded to the media library
 2. Add a gallery block to a post
 3. Click the 'Media Library' button
 4. Open the browser dev tools and inspect the HTML of an image
 5. Observe that the list item element for the image has the role of
 'checkbox':
 {{{
 <li tabindex="0" role="checkbox" aria-label="ac-kitchen" aria-
 checked="false" data-id="594" class="attachment save-ready">
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50273>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list