Ticket #52649: 52649.2.diff
File 52649.2.diff, 8.4 KB (added by , 4 years ago) |
---|
-
src/js/_enqueues/wp/theme.js
404 404 var data = this.model.toJSON(); 405 405 406 406 // Render themes using the html template. 407 this.$el.html( this.html( data ) ).attr({ 408 tabindex: 0, 409 'aria-describedby' : data.id + '-action ' + data.id + '-name', 410 'data-slug': data.id 411 }); 407 this.$el.html( this.html( data ) ).attr( 'data-slug', data.id ); 412 408 413 409 // Renders active theme styles. 414 410 this.activeTheme(); … … 764 760 765 761 // Return focus to the theme div. 766 762 if ( themes.focusedTheme ) { 767 themes.focusedTheme. trigger( 'focus' );763 themes.focusedTheme.find('.more-details').trigger( 'focus' ); 768 764 } 769 765 }); 770 766 } … … 952 948 953 949 // Return focus to the theme div. 954 950 if ( themes.focusedTheme ) { 955 themes.focusedTheme. trigger( 'focus' );951 themes.focusedTheme.find('.more-details').trigger( 'focus' ); 956 952 } 957 953 }).removeClass( 'iframe-ready' ); 958 954 -
src/wp-admin/css/themes.css
66 66 } 67 67 68 68 .theme-browser .theme:hover, 69 .theme-browser .theme :focus {69 .theme-browser .theme.focus { 70 70 cursor: pointer; 71 71 } 72 72 … … 95 95 } 96 96 97 97 .theme-browser .theme:hover .theme-actions, 98 .theme-browser .theme.focus .theme-actions, 99 .theme-browser .theme:focus .theme-actions { 98 .theme-browser .theme.focus .theme-actions { 100 99 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; 101 100 opacity: 1; 102 101 } … … 140 139 } 141 140 142 141 .theme-browser .theme:hover .theme-screenshot, 143 .theme-browser .theme :focus .theme-screenshot {142 .theme-browser .theme.focus .theme-screenshot { 144 143 background: #fff; 145 144 } 146 145 147 146 .theme-browser.rendered .theme:hover .theme-screenshot img, 148 .theme-browser.rendered .theme :focus .theme-screenshot img {147 .theme-browser.rendered .theme.focus .theme-screenshot img { 149 148 opacity: 0.4; 150 149 } 151 150 … … 169 168 transition: opacity 0.1s ease-in-out; 170 169 } 171 170 172 .theme-browser .theme :focus {171 .theme-browser .theme.focus { 173 172 border-color: #4f94d4; 174 173 box-shadow: 0 0 2px rgba(79, 148, 212, 0.8); 175 174 } 176 175 177 .theme-browser .theme :focus .more-details {176 .theme-browser .theme.focus .more-details { 178 177 opacity: 1; 179 178 } 180 179 181 180 /* Current theme needs to have its action always on view */ 182 .theme-browser .theme.active :focus .theme-actions {181 .theme-browser .theme.active.focus .theme-actions { 183 182 display: block; 184 183 } 185 184 186 185 .theme-browser.rendered .theme:hover .more-details, 187 .theme-browser.rendered .theme :focus .more-details {186 .theme-browser.rendered .theme.focus .more-details { 188 187 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; 189 188 opacity: 1; 190 189 } … … 878 877 .theme:not(.active):hover .theme-actions, 879 878 .theme:not(.active):focus .theme-actions, 880 879 .theme:hover .more-details, 881 .theme :focus .more-details {880 .theme.focus .more-details { 882 881 display: none; 883 882 } 884 883 885 884 .theme-browser.rendered .theme:hover .theme-screenshot img, 886 .theme-browser.rendered .theme :focus .theme-screenshot img {885 .theme-browser.rendered .theme.focus .theme-screenshot img { 887 886 opacity: 1.0; 888 887 } 889 888 } -
src/wp-admin/themes.php
379 379 $active_class = ' active'; 380 380 } 381 381 ?> 382 <div class="theme<?php echo $active_class; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">382 <div class="theme<?php echo $active_class; ?>"> 383 383 <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> 384 384 <div class="theme-screenshot"> 385 385 <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> … … 512 512 } 513 513 ?> 514 514 515 <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span> 515 <?php 516 /* translators: %s: Theme name. */ 517 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] ); 518 ?> 519 <button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></button> 516 520 <div class="theme-author"> 517 521 <?php 518 522 /* translators: %s: Theme author name. */ … … 531 535 532 536 <div class="theme-actions"> 533 537 <?php if ( $theme['active'] ) { ?> 534 <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 535 <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> 538 <?php 539 if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 540 /* translators: %s: Theme name. */ 541 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), $theme['name'] ); 542 ?> 543 <a aria-label="<?php echo esc_attr( $customize_aria_label ); ?>" class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> 536 544 <?php } ?> 537 545 <?php } elseif ( $theme['compatibleWP'] && $theme['compatiblePHP'] ) { ?> 538 546 <?php … … 540 548 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 541 549 ?> 542 550 <a class="button activate" href="<?php echo $theme['actions']['activate']; ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a> 543 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 544 <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 551 <?php 552 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 553 /* translators: %s: Theme name. */ 554 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 555 ?> 556 <a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> 545 557 <?php } ?> 546 558 <?php } else { ?> 547 559 <?php … … 859 871 </p></div> 860 872 <# } #> 861 873 862 <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span> 874 <?php 875 /* translators: %s: Theme name. */ 876 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), '{{ data.name }}' ); 877 ?> 878 <button type="button" aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></button> 863 879 <div class="theme-author"> 864 880 <?php 865 881 /* translators: %s: Theme author name. */ … … 879 895 <div class="theme-actions"> 880 896 <# if ( data.active ) { #> 881 897 <# if ( data.actions.customize ) { #> 882 <a class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a> 898 <?php 899 /* translators: %s: Theme name. */ 900 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), '{{ data.name }}' ); 901 ?> 902 <a aria-label="<?php echo esc_attr( $customize_aria_label ); ?>" class="button button-primary customize load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Customize' ); ?></a> 883 903 <# } #> 884 904 <# } else { #> 885 905 <# if ( data.compatibleWP && data.compatiblePHP ) { #> … … 888 908 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 889 909 ?> 890 910 <a class="button activate" href="{{{ data.actions.activate }}}" aria-label="<?php echo $aria_label; ?>"><?php _e( 'Activate' ); ?></a> 891 <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 911 <?php 912 /* translators: %s: Theme name. */ 913 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 914 ?> 915 <a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> 892 916 <# } else { #> 893 917 <?php 894 918 /* translators: %s: Theme name. */