WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#29304 closed defect (bug) (fixed)

Arrow keyboard navigation doesn't work when an item is selected in the media modal

Reported by: helen Owned by: helen
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Media Keywords: has-patch commit
Focuses: accessibility, javascript Cc:
PR Number:

Description

In the media modal, if you select an item and then go back to the grid of items, the right arrow always jumps you back to the first item. The other arrow keys work as expected.

This is compounded by the difficulty in tabbing back to the list in the first place: #29303

Attachments (2)

29304-01.patch (1.4 KB) - added by gcorne 5 years ago.
29304-02.patch (1.4 KB) - added by gcorne 5 years ago.

Download all attachments as: .zip

Change History (8)

#1 @helen
5 years ago

I am fairly certain this was working previously - see #28704 and #23560.

#2 @helen
5 years ago

  • Summary changed from Right arrow keyboard navigation doesn't work when an item is selected in the media modal to Arrow keyboard navigation doesn't work when an item is selected in the media modal

Looks like left arrow doesn't work when you have multiple selected.

@gcorne
5 years ago

#3 @gcorne
5 years ago

In 29304-01.patch, I believe that I have fixed the issue. The main issue is that there are multiple instances of the media.view.Attachments view in the modal. It is used in both the AttachmentsBrowser and via inheritance in Attachments.Selection which meant that the keyboard event was firing twice and the last one was in the context of the selection instance which wasn't the desired behavior. I also added a check to use the current selection if there were no focused list items.

#4 @gcorne
5 years ago

While it was kind of neat for the arrow keys to work when an attachment was selected but none were selected, this breaks using arrows to navigate the form fields in the attachment details. 29304-02.patch removes the code that added that functionality. Doing so, also fixes issues that Helen pointed out with the up/down arrow.

@gcorne
5 years ago

#5 @gcorne
5 years ago

  • Keywords has-patch commit added; needs-patch removed

#6 @helen
5 years ago

  • Owner set to helen
  • Resolution set to fixed
  • Status changed from new to closed

In 29582:

Media: Only fire keyboard events for the Attachments view once.

Firing them twice was breaking arrow key navigation in media attachment grids.

props gcorne.
fixes #29304.

Note: See TracTickets for help on using tickets.