mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-17 03:56:07 +00:00
Media Grid: when closing the modal, automatically focus the proper attachment by reading the model's ID, which is unique.
Props adamsilverstein (for the red), wonderboymusic (for the green). Fixes #28857. Built from https://develop.svn.wordpress.org/trunk@29299 git-svn-id: http://core.svn.wordpress.org/trunk@29081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9436186ee4
commit
0e4c8b2b0c
@ -175,7 +175,6 @@
|
|||||||
wp.media( {
|
wp.media( {
|
||||||
frame: 'edit-attachments',
|
frame: 'edit-attachments',
|
||||||
gridRouter: this.gridRouter,
|
gridRouter: this.gridRouter,
|
||||||
gridItem: $( currentTarget ).closest( 'li' ),
|
|
||||||
library: this.state().get('library'),
|
library: this.state().get('library'),
|
||||||
model: model
|
model: model
|
||||||
} );
|
} );
|
||||||
@ -368,7 +367,6 @@
|
|||||||
state: 'edit-attachment'
|
state: 'edit-attachment'
|
||||||
});
|
});
|
||||||
|
|
||||||
this.gridItem = this.options.gridItem;
|
|
||||||
this.gridRouter = this.options.gridRouter;
|
this.gridRouter = this.options.gridRouter;
|
||||||
this.library = this.options.library;
|
this.library = this.options.library;
|
||||||
if ( this.options.model ) {
|
if ( this.options.model ) {
|
||||||
@ -406,7 +404,7 @@
|
|||||||
self.modal.remove();
|
self.modal.remove();
|
||||||
$( 'body' ).off( 'keydown.media-modal' ); /* remove the keydown event */
|
$( 'body' ).off( 'keydown.media-modal' ); /* remove the keydown event */
|
||||||
// Restore the original focus item if possible
|
// Restore the original focus item if possible
|
||||||
self.gridItem && self.gridItem.focus();
|
$( 'li.attachment[data-id="' + self.model.get( 'id' ) +'"]' ).focus();
|
||||||
self.resetRoute();
|
self.resetRoute();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
2
wp-includes/js/media-grid.min.js
vendored
2
wp-includes/js/media-grid.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4639,7 +4639,11 @@
|
|||||||
options = _.defaults( this.options, {
|
options = _.defaults( this.options, {
|
||||||
rerenderOnModelChange: true
|
rerenderOnModelChange: true
|
||||||
} );
|
} );
|
||||||
this.$el.attr( 'aria-label', this.model.get( 'title' ) ).attr( 'aria-checked', false );
|
this.$el.attr( {
|
||||||
|
'aria-label' : this.model.get( 'title' ),
|
||||||
|
'aria-checked': false,
|
||||||
|
'data-id' : this.model.get( 'id' )
|
||||||
|
} );
|
||||||
|
|
||||||
if ( options.rerenderOnModelChange ) {
|
if ( options.rerenderOnModelChange ) {
|
||||||
this.model.on( 'change', this.render, this );
|
this.model.on( 'change', this.render, this );
|
||||||
|
4
wp-includes/js/media-views.min.js
vendored
4
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user