Opened 12 years ago
Closed 12 years ago
#30348 closed defect (bug) (fixed)
Arrow key navigation in Media Grid skips ids
| Reported by: | UmeshSingla | Owned by: | johnbillion |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.1 |
| Component: | Media | Version: | 4.0 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: | accessibility, javascript |
Description (last modified by )
In grid view, on opening the attachment (Attachment Details screen ), http://monosnap.com/image/oUeB1PEH4elfV9dhJmNijVLAL6eENj, While using arrow keys for navigation, initially the next image loaded is proper, http://monosnap.com/image/DS8dJGHMN5XIH50rUftHURQqFWpd1Z, but after that it skips a id each time http://monosnap.com/image/M3if0DKBKBYvDF35DklfwSwobw8Ak7
To replicate:
Step - 1:
Upload some images and switch to grid view in WordPress
Step - 2:
Click over a image from grid view, which opens attachment details screen for that media. Use the right arrow key for navigation.
Step -3
On pressing right arrow key, firs time the dialog loads the proepr image, but when you press the arrow back it starts skipping the image.
Attachments (2)
Change History (8)
#1
@
12 years ago
On opening modal, this code already handles the keyDown event:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/media-grid.js#L441
this.modal.on( 'open', function () {
$( 'body' ).on( 'keydown.media-modal', _.bind( self.keyEvent, self ) );
} );
And code at https://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/media-grid.js#L391, registers the keyDown event again, which causes the nextMediaItem to call twice and thus skip ids.
#3
@
12 years ago
- Keywords commit added
- Milestone Awaiting Review → 4.1
@UmeshSingla - Wow, thanks for catching that! Having spent a good bit of time working on and testing keyboard navigation in the media grid, I'm embarrassed that we missed that!
I tested your patch and verified the bug exists before applying and is fixed after applying. Please note that convention is to generate diffs from the /trunk folder, makes it a bit easier to apply them :) I regenerated the patch from there and also cleaned up the language describing the keyEvent function.
Thanks again, great work!
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
fixes the bug in media-grid.js