Unable to tab through media items (keyboard accessibility)

Created on 12 May 2022, over 2 years ago
Updated 8 February 2023, over 1 year ago

Problem/Motivation

I found I was unable to use the keyboard to interact with Media Entity Browser. Technically you could tab through them but there was no visible focus state and using space bar to activate the (hidden) checkboxes didn't work.

Steps to reproduce

1. On a drupal site running 9.3.12, add an entity reference field for media images on a content type. Ensure there are at least 2 media images in the media library.

2. On the form edit screen of the content type, select Inline Entity Form - Complex as the widget for the entity reference field you just added.

3. Make sure "Existing media item entities can be referenced" option is checked.

4. Select "Media Entity Browser" for the entity browser. Save.

5. Navigate to a node of the content type you added the field to and edit it.

6. Click "Add existing media item" under the field you added. The media library should show up in a modal.

7. Hit tab key to attempt keyboard navigation. Note that the focus gets stuck on the modal's close button.

8. Click inside the iframe where the media items are. Then begin tabbing. Note that there is a lack of focus state and you are unable to select a media item with the keyboard as well.

Proposed resolution

I am including a patch that allows for keyboard navigation within the iframe. It adds CSS for focus states for the media items and JS that ensures the spacebar checks the checkboxes as expected.

Remaining tasks

Figure out how to get focus from modal's close button into the iframe where the media items are with tabbing.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

πŸ› Bug report
Status

RTBC

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pjudge

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024