Ticket #39859: 39859.diff
File 39859.diff, 3.8 KB (added by , 7 years ago) |
---|
-
src/wp-includes/js/media/views/modal.js
17 17 tagName: 'div', 18 18 template: wp.template('media-modal'), 19 19 20 attributes: {21 tabindex: 022 },23 24 20 events: { 25 21 'click .media-modal-backdrop, .media-modal-close': 'escapeHandler', 26 22 'keydown': 'keydown' … … 32 28 _.defaults( this.options, { 33 29 container: document.body, 34 30 title: '', 35 propagate: true, 36 freeze: true 31 propagate: true 37 32 }); 38 33 39 34 this.focusManager = new wp.media.view.FocusManager({ … … 101 96 this.attach(); 102 97 } 103 98 104 // If the `freeze` option is set, record the window's scroll position.105 if ( options.freeze ) {106 this._freeze = {107 scrollTop: $( window ).scrollTop()108 };109 }110 111 99 // Disable page scrolling. 112 100 $( 'body' ).addClass( 'modal-open' ); 113 101 … … 125 113 } 126 114 } 127 115 128 this.$el.f ocus();116 this.$el.find( '.media-modal' ).focus(); 129 117 130 118 return this.propagate('open'); 131 119 }, … … 135 123 * @returns {wp.media.view.Modal} Returns itself to allow chaining 136 124 */ 137 125 close: function( options ) { 138 var freeze = this._freeze;139 140 126 if ( ! this.views.attached || ! this.$el.is(':visible') ) { 141 127 return this; 142 128 } … … 156 142 157 143 this.propagate('close'); 158 144 159 // If the `freeze` option is set, restore the container's scroll position.160 if ( freeze ) {161 $( window ).scrollTop( freeze.scrollTop );162 }163 164 145 if ( options && options.escape ) { 165 146 this.propagate('escape'); 166 147 } -
src/wp-includes/js/media-views.js
4173 4173 tagName: 'div', 4174 4174 template: wp.template('media-modal'), 4175 4175 4176 attributes: {4177 tabindex: 04178 },4179 4180 4176 events: { 4181 4177 'click .media-modal-backdrop, .media-modal-close': 'escapeHandler', 4182 4178 'keydown': 'keydown' … … 4188 4184 _.defaults( this.options, { 4189 4185 container: document.body, 4190 4186 title: '', 4191 propagate: true, 4192 freeze: true 4187 propagate: true 4193 4188 }); 4194 4189 4195 4190 this.focusManager = new wp.media.view.FocusManager({ … … 4257 4252 this.attach(); 4258 4253 } 4259 4254 4260 // If the `freeze` option is set, record the window's scroll position.4261 if ( options.freeze ) {4262 this._freeze = {4263 scrollTop: $( window ).scrollTop()4264 };4265 }4266 4267 4255 // Disable page scrolling. 4268 4256 $( 'body' ).addClass( 'modal-open' ); 4269 4257 … … 4281 4269 } 4282 4270 } 4283 4271 4284 this.$el.f ocus();4272 this.$el.find( '.media-modal' ).focus(); 4285 4273 4286 4274 return this.propagate('open'); 4287 4275 }, … … 4291 4279 * @returns {wp.media.view.Modal} Returns itself to allow chaining 4292 4280 */ 4293 4281 close: function( options ) { 4294 var freeze = this._freeze;4295 4296 4282 if ( ! this.views.attached || ! this.$el.is(':visible') ) { 4297 4283 return this; 4298 4284 } … … 4312 4298 4313 4299 this.propagate('close'); 4314 4300 4315 // If the `freeze` option is set, restore the container's scroll position.4316 if ( freeze ) {4317 $( window ).scrollTop( freeze.scrollTop );4318 }4319 4320 4301 if ( options && options.escape ) { 4321 4302 this.propagate('escape'); 4322 4303 } -
src/wp-includes/media-template.php
162 162 </script> 163 163 164 164 <script type="text/html" id="tmpl-media-modal"> 165 <div class="<?php echo $class; ?>">165 <div tabindex="0" class="<?php echo $class; ?>"> 166 166 <button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></button> 167 167 <div class="media-modal-content"></div> 168 168 </div>