Ticket #26527: 26527.4.diff
File 26527.4.diff, 6.4 KB (added by , 11 years ago) |
---|
-
wp-admin/js/theme.js
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 // 'enter' and 'space' keys expand the details view when a theme is :focused 225 if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) { 226 return; 227 } 228 222 229 // Bail if the user scrolled on a touch device 223 230 if ( this.touchDrag === true ) { 224 231 return this.touchDrag = false; … … 232 239 return; 233 240 } 234 241 242 themes.focusedTheme = this.$el; 235 243 this.trigger( 'theme:expand', self.model.cid ); 236 244 }, 237 245 … … 266 274 this.navigation(); 267 275 // Checks screenshot size 268 276 this.screenshotCheck( this.$el ); 277 // Contain "tabbing" inside the overlay 278 this.containFocus( this.$el ); 279 280 // Move focus to the default action 281 window.setTimeout( function() { 282 $( '.theme-wrap a.button-primary:visible' ).focus(); 283 }, 500 ) 269 284 }, 270 285 271 286 // Adds a class to the currently active theme … … 275 290 this.$el.toggleClass( 'active', this.model.get( 'active' ) ); 276 291 }, 277 292 293 containFocus: function( $el ) { 294 $el.on( 'keydown.wp-themes', function( event ) { 295 var $target; 296 297 if ( event.which === 9 ) { 298 $target = $( event.target ); 299 300 if ( $target.is( 'button.left' ) && event.shiftKey ) { 301 $el.find( 'a.delete-theme' ).focus(); 302 event.preventDefault(); 303 } else if ( $target.is( 'a.delete-theme' ) ) { 304 $el.find( 'button.left' ).focus(); 305 event.preventDefault(); 306 } 307 } 308 }); 309 }, 310 278 311 // Single theme overlay screen 279 312 // It's shown when clicking a theme 280 313 collapse: function( event ) { … … 291 324 // Detect if the click is inside the overlay 292 325 // and don't close it unless the target was 293 326 // the div.back button 294 if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( ' div.close' ) || event.keyCode === 27 ) {327 if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( '.close' ) || event.keyCode === 27 ) { 295 328 296 329 // Add a temporary closing class while overlay fades out 297 330 $( 'body' ).addClass( 'closing-overlay' ); … … 311 344 312 345 // Restore scroll position 313 346 document.body.scrollTop = scroll; 347 348 // Return focus to the theme div 349 if ( themes.focusedTheme ) { 350 themes.focusedTheme.focus(); 351 } 314 352 }); 315 353 } 316 354 }, -
wp-admin/css/wp-admin.css
6486 6486 -webkit-transition: opacity 0.1s ease-in-out; 6487 6487 transition: opacity 0.1s ease-in-out; 6488 6488 } 6489 .theme-browser .theme:focus { 6490 outline: 1px dotted #000; 6491 } 6492 /* Hide shortcut actions and hover feedback when using tab navigation */ 6493 .theme-browser .theme:focus .theme-actions, 6494 .theme-browser .theme:focus .more-details { 6495 display: none; 6496 } 6497 /* Restore display of theme controls if you hover a focused theme */ 6498 .theme-browser .theme:focus:hover .theme-actions, 6499 .theme-browser .theme:focus:hover .more-details { 6500 display: block; 6501 } 6502 /* Current theme needs to have its action always on view */ 6503 .theme-browser .theme.active:focus .theme-actions { 6504 display: block; 6505 } 6489 6506 6490 6507 .theme-browser.rendered .theme:hover .more-details { 6491 6508 opacity: 1; … … 6711 6728 width: 50px; 6712 6729 text-align: center; 6713 6730 float: right; 6731 border: 0; 6714 6732 border-left: 1px solid #ddd; 6733 background-color: transparent; 6715 6734 } 6716 6735 6717 .theme-overlay .theme-header .close:hover:before { 6736 .theme-overlay .theme-header .close:hover:before, 6737 .theme-overlay .theme-header .close:focus:before { 6718 6738 color: #fff; 6719 6739 } 6720 6740 … … 6731 6751 .theme-overlay .theme-header .left { 6732 6752 cursor: pointer; 6733 6753 color: #777; 6754 background-color: transparent; 6734 6755 height: 48px; 6735 6756 width: 54px; 6736 6757 float: left; 6737 6758 text-align: center; 6759 border: 0; 6738 6760 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 6761 } 6744 6762 6745 6763 .theme-overlay .theme-header .close:hover, 6746 6764 .theme-overlay .theme-header .right:hover, 6747 .theme-overlay .theme-header .left:hover { 6765 .theme-overlay .theme-header .left:hover, 6766 .theme-overlay .theme-header .close:focus, 6767 .theme-overlay .theme-header .right:focus, 6768 .theme-overlay .theme-header .left:focus { 6748 6769 background: #0074a2; 6749 6770 color: #fff; 6750 6771 } -
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="" /> … … 279 279 <# } #> 280 280 <span class="more-details"><?php _e( 'Theme Details' ); ?></span> 281 281 <div class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.author }}}' ); ?></div> 282 282 283 283 <# if ( data.active ) { #> 284 284 <h3 class="theme-name"><span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}</h3> 285 285 <# } else { #> … … 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">