Ticket #52649: 52649-poc.patch
File 52649-poc.patch, 14.2 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.id411 });412 407 408 this.$el.html(this.html(data)).attr('data-slug', data.id); 409 413 410 // Renders active theme styles. 414 411 this.activeTheme(); 415 412 … … 462 459 return; 463 460 } 464 461 465 // Set focused theme to current element.466 themes.focusedTheme = this.$el ;462 // Set focusedTheme to current themes more details button 463 themes.focusedTheme = this.$el.find( '.more-details' ); 467 464 468 465 this.trigger( 'theme:expand', self.model.cid ); 469 466 }, … … 502 499 503 500 event = event || window.event; 504 501 505 // Set focus to current theme.506 themes.focusedTheme = this.$el ;502 // Set focusedTheme to current themes preview button 503 themes.focusedTheme = this.$el.find('.install-theme-preview'); 507 504 508 505 // Construct a new Preview view. 509 506 themes.preview = preview = new themes.view.Preview({ … … 762 759 // Restore scroll position. 763 760 document.body.scrollTop = scroll; 764 761 765 // Return focus to the theme div.762 // Return focus to the curren themes more details button. 766 763 if ( themes.focusedTheme ) { 767 764 themes.focusedTheme.trigger( 'focus' ); 768 765 } -
src/wp-admin/css/themes.css
65 65 margin-right: 0; 66 66 } 67 67 68 .theme-browser .theme:hover, 69 .theme-browser .theme:focus { 68 .theme-browser .theme:hover { 70 69 cursor: pointer; 71 70 } 72 71 … … 84 83 background: rgba(255, 255, 255, 0.65); 85 84 } 86 85 87 /* Activate and Customize buttons, shown on hover and focus */86 /* Details, activate and Customize buttons */ 88 87 .theme-browser .theme .theme-actions { 89 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";90 opacity: 0;91 transition: opacity 0.1s ease-in-out;92 88 height: auto; 93 89 background: rgba(246, 247, 247, 0.7); 94 90 border-left: 1px solid rgba(0, 0, 0, 0.05); 95 91 } 96 92 97 .theme-browser .theme:hover .theme-actions,98 .theme-browser .theme.focus .theme-actions,99 .theme-browser .theme:focus .theme-actions {100 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";101 opacity: 1;102 }103 104 93 .theme-browser .theme .theme-actions .button-primary { 105 94 margin-right: 3px; 106 95 } … … 110 99 margin-left: 3px; 111 100 } 112 101 102 .theme-browser .theme:hover .more-details { 103 background: #f0f0f1; 104 border-color: #0a4b78; 105 color: #0a4b78; 106 } 107 113 108 /** 114 109 * Theme Screenshot 115 110 * … … 121 116 overflow: hidden; 122 117 position: relative; 123 118 -webkit-backface-visibility: hidden; /* Prevents flicker of the screenshot on hover. */ 124 transition: opacity 0.2s ease-in-out;125 119 } 126 120 127 121 .theme-browser .theme .theme-screenshot:after { … … 136 130 left: 0; 137 131 top: 0; 138 132 width: 100%; 139 transition: opacity 0.2s ease-in-out;140 133 } 141 134 142 .theme-browser .theme:hover .theme-screenshot,143 .theme-browser .theme:focus .theme-screenshot {144 background: #fff;145 }146 147 .theme-browser.rendered .theme:hover .theme-screenshot img,148 .theme-browser.rendered .theme:focus .theme-screenshot img {149 opacity: 0.4;150 }151 152 .theme-browser .theme .more-details {153 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";154 opacity: 0;155 position: absolute;156 top: 35%;157 right: 20%;158 left: 20%;159 background: #1d2327;160 background: rgba(0, 0, 0, 0.7);161 color: #fff;162 font-size: 15px;163 text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);164 -webkit-font-smoothing: antialiased;165 font-weight: 600;166 padding: 15px 12px;167 text-align: center;168 border-radius: 3px;169 transition: opacity 0.1s ease-in-out;170 }171 172 .theme-browser .theme:focus {173 border-color: #4f94d4;174 box-shadow: 0 0 2px rgba(79, 148, 212, 0.8);175 }176 177 .theme-browser .theme:focus .more-details {178 opacity: 1;179 }180 181 /* Current theme needs to have its action always on view */182 .theme-browser .theme.active:focus .theme-actions {183 display: block;184 }185 186 .theme-browser.rendered .theme:hover .more-details,187 .theme-browser.rendered .theme:focus .more-details {188 -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";189 opacity: 1;190 }191 192 135 /** 193 136 * The currently active theme 194 137 */ … … 209 152 } 210 153 211 154 .theme-browser .theme.active .theme-actions { 212 background: rgba(44, 51, 56, 0.7);155 background: #1d2327; 213 156 border-left: none; 214 157 opacity: 1; 215 158 } … … 220 163 221 164 .theme-browser .theme.active .theme-actions, 222 165 .theme-browser .theme .theme-actions { 223 position: absolute;224 top: 50%;225 transform: translateY(-50%);226 166 right: 0; 227 167 padding: 9px 15px; 228 168 box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.1); … … 875 815 width: auto; 876 816 } 877 817 878 .theme:not(.active):hover .theme-actions,879 .theme:not(.active):focus .theme-actions,880 .theme:hover .more-details,881 .theme:focus .more-details {882 display: none;883 }884 885 818 .theme-browser.rendered .theme:hover .theme-screenshot img, 886 819 .theme-browser.rendered .theme:focus .theme-screenshot img { 887 820 opacity: 1.0; -
src/wp-admin/theme-install.php
331 331 </p></div> 332 332 <# } #> 333 333 334 <span class="more-details"><?php _ex( 'Details & Preview', 'theme' ); ?></span>335 334 <div class="theme-author"> 336 335 <?php 337 336 /* translators: %s: Theme author name. */ … … 358 357 <# } #> 359 358 <# if ( data.customize_url ) { #> 360 359 <# if ( ! data.active ) { #> 361 <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a> 360 <?php 361 /* translators: %s: Theme name. */ 362 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 363 ?> 364 <a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a> 362 365 <# } else { #> 363 <a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a> 366 <?php 367 /* translators: %s: Theme name. */ 368 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), '{{ data.name }}' ); 369 ?> 370 <a aria-label="<?php echo esc_attr( $customize_aria_label ); ?>" class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Customize' ); ?></a> 364 371 <# } #> 365 372 <# } else { #> 366 <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> 373 <?php 374 /* translators: %s: Theme name. */ 375 $preview_aria_label = sprintf( _x( 'Preview %s', 'theme' ), '{{ data.name }}' ); 376 ?> 377 <button aria-label="<?php echo esc_attr( $preview_aria_label ); ?>" class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> 367 378 <# } #> 368 379 <# } else { #> 369 380 <?php … … 374 385 <a class="button button-primary disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a> 375 386 <# } #> 376 387 <# if ( data.customize_url ) { #> 377 <a class="button disabled"><?php _e( 'Live Preview' ); ?></a> 388 <?php 389 /* translators: %s: Theme name. */ 390 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 391 ?> 392 <a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button disabled"><?php _e( 'Live Preview' ); ?></a> 378 393 <# } else { #> 379 <button class="button disabled"><?php _e( 'Preview' ); ?></button> 394 <?php 395 /* translators: %s: Theme name. */ 396 $preview_aria_label = sprintf( _x( 'Preview %s', 'theme' ), '{{ data.name }}' ); 397 ?> 398 <button aria-label="<?php echo esc_attr( $preview_aria_label ); ?>" class="button disabled"><?php _e( 'Preview' ); ?></button> 380 399 <# } #> 381 400 <# } #> 382 401 <# } else { #> … … 386 405 $aria_label = sprintf( _x( 'Install %s', 'theme' ), '{{ data.name }}' ); 387 406 ?> 388 407 <a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a> 389 <button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> 408 <?php 409 /* translators: %s: Theme name. */ 410 $preview_aria_label = sprintf( _x( 'Preview %s', 'theme' ), '{{ data.name }}' ); 411 ?> 412 <button aria-label="<?php echo esc_attr( $preview_aria_label ); ?>" class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button> 390 413 <# } else { #> 391 414 <?php 392 415 /* translators: %s: Theme name. */ -
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>516 <div class="theme-author">517 <?php518 /* translators: %s: Theme author name. */519 printf( __( 'By %s' ), $theme['author'] );520 ?>521 </div>522 523 515 <div class="theme-id-container"> 524 516 <?php if ( $theme['active'] ) { ?> 525 517 <h2 class="theme-name" id="<?php echo $aria_name; ?>"> … … 530 522 <?php } ?> 531 523 532 524 <div class="theme-actions"> 525 <?php 526 /* translators: %s: Theme name. */ 527 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] ); 528 ?> 529 <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> 533 530 <?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> 531 <?php 532 if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 533 /* translators: %s: Theme name. */ 534 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), $theme['name'] ); 535 ?> 536 <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 537 <?php } ?> 537 538 <?php } elseif ( $theme['compatibleWP'] && $theme['compatiblePHP'] ) { ?> 538 539 <?php … … 549 550 $aria_label = sprintf( _x( 'Cannot Activate %s', 'theme' ), '{{ data.name }}' ); 550 551 ?> 551 552 <a class="button disabled" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _ex( 'Cannot Activate', 'theme' ); ?></a> 552 <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> 553 <a class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 553 <?php 554 if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { 555 /* translators: %s: Theme name. */ 556 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 557 ?> 558 <a aria-label="<?php echo esc_attr( $live_preview_aria_label ); ?>" class="button button-primary hide-if-no-customize disabled"><?php _e( 'Live Preview' ); ?></a> 554 559 <?php } ?> 555 560 <?php } ?> 556 561 … … 859 864 </p></div> 860 865 <# } #> 861 866 862 <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>863 <div class="theme-author">864 <?php865 /* translators: %s: Theme author name. */866 printf( __( 'By %s' ), '{{{ data.author }}}' );867 ?>868 </div>869 870 867 <div class="theme-id-container"> 871 868 <# if ( data.active ) { #> 872 869 <h2 class="theme-name" id="{{ data.id }}-name"> … … 877 874 <# } #> 878 875 879 876 <div class="theme-actions"> 877 <?php 878 /* translators: %s: Theme name. */ 879 $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), '{{ data.name }}' ); 880 ?> 881 <button aria-label="<?php echo esc_attr( $details_aria_label ); ?>" class="button more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></button> 880 882 <# if ( data.active ) { #> 881 883 <# 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> 884 <?php 885 /* translators: %s: Theme name. */ 886 $customize_aria_label = sprintf( _x( 'Customize %s', 'theme' ), '{{ data.name }}' ); 887 ?> 888 <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 889 <# } #> 884 890 <# } else { #> 885 891 <# if ( data.compatibleWP && data.compatiblePHP ) { #> … … 888 894 $aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' ); 889 895 ?> 890 896 <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> 897 <?php 898 /* translators: %s: Theme name. */ 899 $live_preview_aria_label = sprintf( _x( 'Live Preview %s', 'theme' ), '{{ data.name }}' ); 900 ?> 901 <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 902 <# } else { #> 893 903 <?php 894 904 /* translators: %s: Theme name. */