Ticket #26527: 26527.7.diff
File 26527.7.diff, 6.8 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 event = event || window.event; 225 226 // 'enter' and 'space' keys expand the details view when a theme is :focused 227 if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) { 228 return; 229 } 230 222 231 // Bail if the user scrolled on a touch device 223 232 if ( this.touchDrag === true ) { 224 233 return this.touchDrag = false; 225 234 } 226 235 227 event = event || window.event;228 229 236 // Prevent the modal from showing when the user clicks 230 237 // one of the direct action buttons 231 238 if ( $( event.target ).is( '.theme-actions a' ) ) { 232 239 return; 233 240 } 234 241 242 // Set focused theme to current element 243 themes.focusedTheme = this.$el; 244 235 245 this.trigger( 'theme:expand', self.model.cid ); 236 246 }, 237 247 … … 266 276 this.navigation(); 267 277 // Checks screenshot size 268 278 this.screenshotCheck( this.$el ); 279 // Contain "tabbing" inside the overlay 280 this.containFocus( this.$el ); 281 282 // Move focus to the default action 283 window.setTimeout( function() { 284 $( '.theme-wrap a.button-primary:visible' ).focus(); 285 }, 500 ); 269 286 }, 270 287 271 288 // Adds a class to the currently active theme … … 275 292 this.$el.toggleClass( 'active', this.model.get( 'active' ) ); 276 293 }, 277 294 295 // Keeps :focus within the theme details elements 296 containFocus: function( $el ) { 297 var $target; 298 299 $el.on( 'keydown.wp-themes', function( event ) { 300 301 event = event || window.event; 302 303 // Tab key 304 if ( event.which === 9 ) { 305 $target = $( event.target ); 306 307 // Keep focus within the overlay by making the last link on theme actions 308 // switch focus to button.left on tabbing and vice versa 309 if ( $target.is( 'button.left' ) && event.shiftKey ) { 310 $el.find( '.theme-actions a:last-child' ).focus(); 311 event.preventDefault(); 312 } else if ( $target.is( '.theme-actions a:last-child' ) ) { 313 $el.find( 'button.left' ).focus(); 314 event.preventDefault(); 315 } 316 } 317 }); 318 }, 319 278 320 // Single theme overlay screen 279 321 // It's shown when clicking a theme 280 322 collapse: function( event ) { … … 291 333 // Detect if the click is inside the overlay 292 334 // and don't close it unless the target was 293 335 // the div.back button 294 if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( ' div.close' ) || event.keyCode === 27 ) {336 if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( '.close' ) || event.keyCode === 27 ) { 295 337 296 338 // Add a temporary closing class while overlay fades out 297 339 $( 'body' ).addClass( 'closing-overlay' ); … … 311 353 312 354 // Restore scroll position 313 355 document.body.scrollTop = scroll; 356 357 // Return focus to the theme div 358 if ( themes.focusedTheme ) { 359 themes.focusedTheme.focus(); 360 } 314 361 }); 315 362 } 316 363 }, -
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 #222; 6491 } 6492 /* Hide shortcut actions and hover feedback when using tab navigation */ 6493 .theme-browser .theme:focus .theme-actions { 6494 display: none; 6495 } 6496 /* Restore display of theme controls if you hover a focused theme */ 6497 .theme-browser .theme:focus:hover .theme-actions { 6498 display: block; 6499 } 6500 .theme-browser .theme:focus .more-details { 6501 opacity: 1; 6502 } 6503 /* Current theme needs to have its action always on view */ 6504 .theme-browser .theme.active:focus .theme-actions { 6505 display: block; 6506 } 6489 6507 6490 6508 .theme-browser.rendered .theme:hover .more-details { 6491 6509 opacity: 1; … … 6711 6729 width: 50px; 6712 6730 text-align: center; 6713 6731 float: right; 6732 border: 0; 6714 6733 border-left: 1px solid #ddd; 6734 background-color: transparent; 6715 6735 } 6716 6736 6717 .theme-overlay .theme-header .close:hover:before { 6737 .theme-overlay .theme-header .close:hover:before, 6738 .theme-overlay .theme-header .close:focus:before { 6718 6739 color: #fff; 6719 6740 } 6720 6741 … … 6731 6752 .theme-overlay .theme-header .left { 6732 6753 cursor: pointer; 6733 6754 color: #777; 6755 background-color: transparent; 6734 6756 height: 48px; 6735 6757 width: 54px; 6736 6758 float: left; 6737 6759 text-align: center; 6760 border: 0; 6738 6761 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 6762 } 6744 6763 6745 6764 .theme-overlay .theme-header .close:hover, 6746 6765 .theme-overlay .theme-header .right:hover, 6747 .theme-overlay .theme-header .left:hover { 6766 .theme-overlay .theme-header .left:hover, 6767 .theme-overlay .theme-header .close:focus, 6768 .theme-overlay .theme-header .right:focus, 6769 .theme-overlay .theme-header .left:focus { 6748 6770 background: #0074a2; 6749 6771 color: #fff; 6750 6772 } -
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">