Ticket #39859: 39859.2.diff
File 39859.2.diff, 4.1 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({ … … 88 83 */ 89 84 open: function() { 90 85 var $el = this.$el, 91 options = this.options,92 86 mceEditor; 93 87 94 88 if ( $el.is(':visible') ) { … … 101 95 this.attach(); 102 96 } 103 97 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 98 // Disable page scrolling. 112 99 $( 'body' ).addClass( 'modal-open' ); 113 100 … … 125 112 } 126 113 } 127 114 128 this.$el.f ocus();115 this.$el.find( '.media-modal' ).focus(); 129 116 130 117 return this.propagate('open'); 131 118 }, … … 135 122 * @returns {wp.media.view.Modal} Returns itself to allow chaining 136 123 */ 137 124 close: function( options ) { 138 var freeze = this._freeze;139 140 125 if ( ! this.views.attached || ! this.$el.is(':visible') ) { 141 126 return this; 142 127 } … … 156 141 157 142 this.propagate('close'); 158 143 159 // If the `freeze` option is set, restore the container's scroll position.160 if ( freeze ) {161 $( window ).scrollTop( freeze.scrollTop );162 }163 164 144 if ( options && options.escape ) { 165 145 this.propagate('escape'); 166 146 } -
src/wp-includes/js/media-views.js
4248 4248 tagName: 'div', 4249 4249 template: wp.template('media-modal'), 4250 4250 4251 attributes: {4252 tabindex: 04253 },4254 4255 4251 events: { 4256 4252 'click .media-modal-backdrop, .media-modal-close': 'escapeHandler', 4257 4253 'keydown': 'keydown' … … 4263 4259 _.defaults( this.options, { 4264 4260 container: document.body, 4265 4261 title: '', 4266 propagate: true, 4267 freeze: true 4262 propagate: true 4268 4263 }); 4269 4264 4270 4265 this.focusManager = new wp.media.view.FocusManager({ … … 4319 4314 */ 4320 4315 open: function() { 4321 4316 var $el = this.$el, 4322 options = this.options,4323 4317 mceEditor; 4324 4318 4325 4319 if ( $el.is(':visible') ) { … … 4332 4326 this.attach(); 4333 4327 } 4334 4328 4335 // If the `freeze` option is set, record the window's scroll position.4336 if ( options.freeze ) {4337 this._freeze = {4338 scrollTop: $( window ).scrollTop()4339 };4340 }4341 4342 4329 // Disable page scrolling. 4343 4330 $( 'body' ).addClass( 'modal-open' ); 4344 4331 … … 4356 4343 } 4357 4344 } 4358 4345 4359 this.$el.f ocus();4346 this.$el.find( '.media-modal' ).focus(); 4360 4347 4361 4348 return this.propagate('open'); 4362 4349 }, … … 4366 4353 * @returns {wp.media.view.Modal} Returns itself to allow chaining 4367 4354 */ 4368 4355 close: function( options ) { 4369 var freeze = this._freeze;4370 4371 4356 if ( ! this.views.attached || ! this.$el.is(':visible') ) { 4372 4357 return this; 4373 4358 } … … 4387 4372 4388 4373 this.propagate('close'); 4389 4374 4390 // If the `freeze` option is set, restore the container's scroll position.4391 if ( freeze ) {4392 $( window ).scrollTop( freeze.scrollTop );4393 }4394 4395 4375 if ( options && options.escape ) { 4396 4376 this.propagate('escape'); 4397 4377 } -
src/wp-includes/media-template.php
182 182 </script> 183 183 184 184 <script type="text/html" id="tmpl-media-modal"> 185 <div class="<?php echo $class; ?>">185 <div tabindex="0" class="<?php echo $class; ?>"> 186 186 <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> 187 187 <div class="media-modal-content"></div> 188 188 </div>