Ticket #38142: 38142.diff
File 38142.diff, 2.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/media/views/modal.js
24 24 'keydown': 'keydown' 25 25 }, 26 26 27 clickedOpenerEl: null, 28 27 29 initialize: function() { 28 30 _.defaults( this.options, { 29 31 container: document.body, … … 91 93 return this; 92 94 } 93 95 96 this.clickedOpenerEl = document.activeElement; 97 94 98 if ( ! this.views.attached ) { 95 99 this.attach(); 96 100 } … … 141 145 // Hide modal and remove restricted media modal tab focus once it's closed 142 146 this.$el.hide().undelegate( 'keydown' ); 143 147 144 // Put focus back in useful location once modal is closed 145 $('#wpbody-content').focus(); 148 // Put focus back in useful location once modal is closed. 149 if ( null !== this.clickedOpenerEl ) { 150 this.clickedOpenerEl.focus(); 151 } else { 152 $( '#wpbody-content' ).focus(); 153 } 146 154 147 155 this.propagate('close'); 148 156 -
src/wp-includes/js/media-editor.js
1111 1111 1112 1112 event.preventDefault(); 1113 1113 1114 // Remove focus from the `.insert-media` button.1115 // Prevents Opera from showing the outline of the button1116 // above the modal.1117 //1118 // See: https://core.trac.wordpress.org/ticket/224451119 elem.blur();1120 1121 1114 if ( elem.hasClass( 'gallery' ) ) { 1122 1115 options.state = 'gallery'; 1123 1116 options.title = wp.media.view.l10n.createGalleryTitle; -
src/wp-includes/js/media-views.js
6698 6698 'keydown': 'keydown' 6699 6699 }, 6700 6700 6701 clickedOpenerEl: null, 6702 6701 6703 initialize: function() { 6702 6704 _.defaults( this.options, { 6703 6705 container: document.body, … … 6765 6767 return this; 6766 6768 } 6767 6769 6770 this.clickedOpenerEl = document.activeElement; 6771 6768 6772 if ( ! this.views.attached ) { 6769 6773 this.attach(); 6770 6774 } … … 6815 6819 // Hide modal and remove restricted media modal tab focus once it's closed 6816 6820 this.$el.hide().undelegate( 'keydown' ); 6817 6821 6818 // Put focus back in useful location once modal is closed 6819 $('#wpbody-content').focus(); 6822 // Put focus back in useful location once modal is closed. 6823 if ( null !== this.clickedOpenerEl ) { 6824 this.clickedOpenerEl.focus(); 6825 } else { 6826 $( '#wpbody-content' ).focus(); 6827 } 6820 6828 6821 6829 this.propagate('close'); 6822 6830