Changeset 42627
- Timestamp:
- 01/31/2018 11:54:02 PM (8 years ago)
- Location:
- branches/4.9
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
src/wp-includes/js/media-views.js (modified) (8 diffs)
-
src/wp-includes/js/media/views/modal.js (modified) (8 diffs)
-
src/wp-includes/media-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-includes/js/media-views.js
r42600 r42627 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', … … 4189 4185 container: document.body, 4190 4186 title: '', 4191 propagate: true, 4192 freeze: true 4187 propagate: true 4193 4188 }); 4194 4189 … … 4245 4240 open: function() { 4246 4241 var $el = this.$el, 4247 options = this.options,4248 4242 mceEditor; 4249 4243 … … 4258 4252 } 4259 4253 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 4254 // Disable page scrolling. 4268 4255 $( 'body' ).addClass( 'modal-open' ); … … 4272 4259 // Try to close the onscreen keyboard 4273 4260 if ( 'ontouchend' in document ) { 4274 if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor ) && ! mceEditor.isHidden() && mceEditor.iframeElement ) {4261 if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor ) && ! mceEditor.isHidden() && mceEditor.iframeElement ) { 4275 4262 mceEditor.iframeElement.focus(); 4276 4263 mceEditor.iframeElement.blur(); … … 4282 4269 } 4283 4270 4284 this.$el.focus(); 4271 // Set initial focus on the content instead of this view element, to avoid page scrolling. 4272 this.$( '.media-modal' ).focus(); 4285 4273 4286 4274 return this.propagate('open'); … … 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; … … 4312 4298 4313 4299 this.propagate('close'); 4314 4315 // If the `freeze` option is set, restore the container's scroll position.4316 if ( freeze ) {4317 $( window ).scrollTop( freeze.scrollTop );4318 }4319 4300 4320 4301 if ( options && options.escape ) { -
branches/4.9/src/wp-includes/js/media/views/modal.js
r41351 r42627 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 ) && ! mceEditor.isHidden() && mceEditor.iframeElement ) {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'); -
branches/4.9/src/wp-includes/media-template.php
r41325 r42627 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>
Note: See TracChangeset
for help on using the changeset viewer.