Changeset 42624
- Timestamp:
- 01/31/2018 05:02:27 PM (7 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-views.js
r42599 r42624 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', … … 4264 4260 container: document.body, 4265 4261 title: '', 4266 propagate: true, 4267 freeze: true 4262 propagate: true 4268 4263 }); 4269 4264 … … 4320 4315 open: function() { 4321 4316 var $el = this.$el, 4322 options = this.options,4323 4317 mceEditor; 4324 4318 … … 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' ); … … 4347 4334 // Try to close the onscreen keyboard 4348 4335 if ( 'ontouchend' in document ) { 4349 if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor ) 4336 if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor ) && ! mceEditor.isHidden() && mceEditor.iframeElement ) { 4350 4337 mceEditor.iframeElement.focus(); 4351 4338 mceEditor.iframeElement.blur(); … … 4357 4344 } 4358 4345 4359 this.$el.focus(); 4346 // Set initial focus on the content instead of this view element, to avoid page scrolling. 4347 this.$( '.media-modal' ).focus(); 4360 4348 4361 4349 return this.propagate('open'); … … 4367 4355 */ 4368 4356 close: function( options ) { 4369 var freeze = this._freeze;4370 4371 4357 if ( ! this.views.attached || ! this.$el.is(':visible') ) { 4372 4358 return this; … … 4387 4373 4388 4374 this.propagate('close'); 4389 4390 // If the `freeze` option is set, restore the container's scroll position.4391 if ( freeze ) {4392 $( window ).scrollTop( freeze.scrollTop );4393 }4394 4375 4395 4376 if ( options && options.escape ) { -
trunk/src/wp-includes/js/media/views/modal.js
r41351 r42624 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', … … 33 29 container: document.body, 34 30 title: '', 35 propagate: true, 36 freeze: true 31 propagate: true 37 32 }); 38 33 … … 89 84 open: function() { 90 85 var $el = this.$el, 91 options = this.options,92 86 mceEditor; 93 87 … … 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' ); … … 116 103 // Try to close the onscreen keyboard 117 104 if ( 'ontouchend' in document ) { 118 if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor ) 105 if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor ) && ! mceEditor.isHidden() && mceEditor.iframeElement ) { 119 106 mceEditor.iframeElement.focus(); 120 107 mceEditor.iframeElement.blur(); … … 126 113 } 127 114 128 this.$el.focus(); 115 // Set initial focus on the content instead of this view element, to avoid page scrolling. 116 this.$( '.media-modal' ).focus(); 129 117 130 118 return this.propagate('open'); … … 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; … … 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'); -
trunk/src/wp-includes/media-template.php
r42444 r42624 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>
Note: See TracChangeset
for help on using the changeset viewer.