Ticket #26527: 26527.3.diff
File 26527.3.diff, 7.4 KB (added by , 11 years ago) |
---|
-
src/wp-admin/css/wp-admin.css
6416 6416 border-left: 1px solid rgba(0,0,0,0.05); 6417 6417 } 6418 6418 6419 .theme-browser .theme:focus .theme-actions, 6420 .theme-browser .theme.hover .theme-actions, 6419 6421 .theme-browser .theme:hover .theme-actions { 6420 6422 opacity: 1; 6421 6423 } … … 6471 6473 .theme-browser .theme .more-details { 6472 6474 opacity: 0; 6473 6475 position: absolute; 6474 top: 35%; 6475 right: 25%; 6476 left: 25%; 6476 top: 35%; 6477 right: 25%; 6478 left: 25%; 6479 margin: auto; 6480 width: 50%; 6477 6481 background: rgba(0,0,0,0.7); 6478 6482 color: #fff; 6479 6483 font-size: 15px; … … 6482 6486 font-weight: 600; 6483 6487 padding: 15px 12px; 6484 6488 text-align: center; 6489 border: 0; 6485 6490 border-radius: 3px; 6486 6491 -webkit-transition: opacity 0.1s ease-in-out; 6487 6492 transition: opacity 0.1s ease-in-out; 6488 6493 } 6489 6494 6495 .theme-browser .theme .more-details:focus { 6496 outline: 1px dotted #000; 6497 } 6498 6499 .theme-browser.rendered .theme.hover .more-details, 6490 6500 .theme-browser.rendered .theme:hover .more-details { 6491 6501 opacity: 1; 6492 6502 } … … 6711 6721 width: 50px; 6712 6722 text-align: center; 6713 6723 float: right; 6724 border: 0; 6714 6725 border-left: 1px solid #ddd; 6726 background-color: transparent; 6715 6727 } 6716 6728 6717 .theme-overlay .theme-header .close:hover:before { 6729 .theme-overlay .theme-header .close:hover:before, 6730 .theme-overlay .theme-header .close:focus:before { 6718 6731 color: #fff; 6719 6732 } 6720 6733 … … 6731 6744 .theme-overlay .theme-header .left { 6732 6745 cursor: pointer; 6733 6746 color: #777; 6747 background-color: transparent; 6734 6748 height: 48px; 6735 6749 width: 54px; 6736 6750 float: left; 6737 6751 text-align: center; 6752 border: 0; 6738 6753 border-right: 1px solid #ddd; 6739 -webkit-user-select: none;6740 -moz-user-select: none;6741 -ms-user-select: none;6742 user-select: none;6743 6754 } 6744 6755 6745 6756 .theme-overlay .theme-header .close:hover, 6746 6757 .theme-overlay .theme-header .right:hover, 6747 .theme-overlay .theme-header .left:hover { 6758 .theme-overlay .theme-header .left:hover, 6759 .theme-overlay .theme-header .close:focus, 6760 .theme-overlay .theme-header .right:focus, 6761 .theme-overlay .theme-header .left:focus { 6748 6762 background: #0074a2; 6749 6763 color: #fff; 6750 6764 } -
src/wp-admin/js/theme.js
4 4 ( function($) { 5 5 6 6 // Set up our namespace... 7 var themes, l10n ;7 var themes, l10n, $focusedTheme; 8 8 themes = wp.themes = wp.themes || {}; 9 9 10 10 // Store the theme data and settings for organized and quick access … … 188 188 189 189 events: { 190 190 'click': 'expand', 191 'keydown': 'expand', 191 192 'touchend': 'expand', 192 193 'touchmove': 'preventExpand' 193 194 }, … … 197 198 render: function() { 198 199 var data = this.model.toJSON(); 199 200 // Render themes using the html template 200 this.$el.html( this.html( data ) ); 201 this.$el.html( this.html( data ) ).attr( 'tabindex', 0 ); 202 201 203 // Renders active theme styles 202 204 this.activeTheme(); 203 205 … … 219 221 expand: function( event ) { 220 222 var self = this; 221 223 224 if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) { // enter && space 225 return; 226 } 227 222 228 // Bail if the user scrolled on a touch device 223 229 if ( this.touchDrag === true ) { 224 230 return this.touchDrag = false; … … 232 238 return; 233 239 } 234 240 241 $focusedTheme = this.$el; 235 242 this.trigger( 'theme:expand', self.model.cid ); 236 243 }, 237 244 … … 266 273 this.navigation(); 267 274 // Checks screenshot size 268 275 this.screenshotCheck( this.$el ); 276 // Contain "tabbing" inside the overlay 277 this.containFocus( this.$el ); 278 279 // Move focus to the default action 280 window.setTimeout( function() { 281 $( '.theme-wrap a.button-primary:visible' ).focus(); 282 }, 500 ) 269 283 }, 270 284 271 285 // Adds a class to the currently active theme … … 275 289 this.$el.toggleClass( 'active', this.model.get( 'active' ) ); 276 290 }, 277 291 292 containFocus: function( $el ) { 293 $el.on( 'keydown.wp-themes', function( event ) { 294 var $target; 295 296 if ( event.which === 9 ) { 297 $target = $( event.target ); 298 299 if ( $target.is( 'button.left' ) && event.shiftKey ) { 300 $el.find( 'a.delete-theme' ).focus(); 301 event.preventDefault(); 302 } else if ( $target.is( 'a.delete-theme' ) ) { 303 $el.find( 'button.left' ).focus(); 304 event.preventDefault(); 305 } 306 } 307 }); 308 }, 309 278 310 // Single theme overlay screen 279 311 // It's shown when clicking a theme 280 312 collapse: function( event ) { … … 291 323 // Detect if the click is inside the overlay 292 324 // and don't close it unless the target was 293 325 // the div.back button 294 if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( ' div.close' ) || event.keyCode === 27 ) {326 if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( '.close' ) || event.keyCode === 27 ) { 295 327 296 328 // Add a temporary closing class while overlay fades out 297 329 $( 'body' ).addClass( 'closing-overlay' ); … … 311 343 312 344 // Restore scroll position 313 345 document.body.scrollTop = scroll; 346 347 // Return focus to the theme div 348 if ( $focusedTheme ) { 349 $focusedTheme.focus(); 350 } 314 351 }); 315 352 } 316 353 }, … … 735 772 }; 736 773 737 774 $(window).resize(function(){ tb_position(); }); 775 776 $('.theme-browser .theme').on( 'focusin.wp-themes', function() { 777 $(this).addClass('hover').siblings('.hover').removeClass('hover'); 778 }).on( 'focusout.wp-themes blur.wp-themes', function() { 779 $(this).removeClass('hover'); 780 }); 738 781 }); -
src/wp-admin/themes.php
192 192 */ 193 193 194 194 foreach ( $themes as $theme ) : ?> 195 <div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" >195 <div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0"> 196 196 <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> 197 197 <div class="theme-screenshot"> 198 198 <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> … … 200 200 <?php } else { ?> 201 201 <div class="theme-screenshot blank"></div> 202 202 <?php } ?> 203 < span class="more-details"><?php _e( 'Theme Details' ); ?></span>203 <button class="more-details"><?php _e( 'Theme Details' ); ?></button> 204 204 <div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div> 205 205 206 206 <?php if ( $theme['active'] ) { ?> … … 277 277 <# } else { #> 278 278 <div class="theme-screenshot blank"></div> 279 279 <# } #> 280 < span class="more-details"><?php _e( 'Theme Details' ); ?></span>280 <button class="more-details" tabindex="0"><?php _e( 'Theme Details' ); ?></button> 281 281 <div class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.author }}}' ); ?></div> 282 282 283 283 <# if ( data.active ) { #> … … 309 309 <div class="theme-backdrop"></div> 310 310 <div class="theme-wrap"> 311 311 <div class="theme-header"> 312 < div alt="<?php _e( 'Close overlay' ); ?>" class="close dashicons dashicons-no"></div>313 < div alt="<?php _e( 'Show previous theme' ); ?>" class="left dashicons dashicons-no"></div>314 < div alt="<?php _e( 'Show next theme' ); ?>" class="right dashicons dashicons-no"></div>312 <button alt="<?php _e( 'Show previous theme' ); ?>" class="left dashicons dashicons-no"></button> 313 <button alt="<?php _e( 'Show next theme' ); ?>" class="right dashicons dashicons-no"></button> 314 <button alt="<?php _e( 'Close overlay' ); ?>" class="close dashicons dashicons-no"></button> 315 315 </div> 316 316 <div class="theme-about"> 317 317 <div class="theme-screenshots">