<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27804] trunk/src/wp-admin: Bring keyboard accessibility to the theme install screen and theme action buttons.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27804">27804</a></dd>
<dt>Author</dt> <dd>helen</dd>
<dt>Date</dt> <dd>2014-03-28 03:15:30 +0000 (Fri, 28 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Bring keyboard accessibility to the theme install screen and theme action buttons. props jorbin. see <a href="http://core.trac.wordpress.org/ticket/27521">#27521</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsscolors_adminscss">trunk/src/wp-admin/css/colors/_admin.scss</a></li>
<li><a href="#trunksrcwpadmincssthemescss">trunk/src/wp-admin/css/themes.css</a></li>
<li><a href="#trunksrcwpadminjsthemejs">trunk/src/wp-admin/js/theme.js</a></li>
<li><a href="#trunksrcwpadminthemeinstallphp">trunk/src/wp-admin/theme-install.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsscolors_adminscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/colors/_admin.scss (27803 => 27804)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/colors/_admin.scss        2014-03-28 03:01:43 UTC (rev 27803)
+++ trunk/src/wp-admin/css/colors/_admin.scss   2014-03-28 03:15:30 UTC (rev 27804)
</span><span class="lines">@@ -439,10 +439,19 @@
</span><span class="cx"> 
</span><span class="cx"> body.more-filters-opened .more-filters,
</span><span class="cx"> body.more-filters-opened .more-filters:before {
</span><ins>+       color: $menu-text;
+       background-color: $menu-background;
+}
+
+body.more-filters-opened .more-filters:hover,
+body.more-filters-opened .more-filters:focus,
+body.more-filters-opened .more-filters:hover:before,
+body.more-filters-opened .more-filters:focus:before {
+       background-color: $menu-highlight-background;
</ins><span class="cx">   color: $menu-highlight-text;
</span><del>-       background-color: $menu-highlight-background;
</del><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> /* jQuery UI Slider */
</span><span class="cx"> 
</span><span class="cx"> .wp-slider .ui-slider-handle,
</span></span></pre></div>
<a id="trunksrcwpadmincssthemescss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/themes.css (27803 => 27804)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/themes.css        2014-03-28 03:01:43 UTC (rev 27803)
+++ trunk/src/wp-admin/css/themes.css   2014-03-28 03:15:30 UTC (rev 27804)
</span><span class="lines">@@ -40,6 +40,10 @@
</span><span class="cx">  top: -3px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.theme-navigation a {
+       text-decoration:none;
+}
+
</ins><span class="cx"> /* Position admin messages */
</span><span class="cx"> .themes-php div.updated,
</span><span class="cx"> .themes-php div.error {
</span><span class="lines">@@ -97,7 +101,7 @@
</span><span class="cx">  background: rgba(255,255,255,0.65);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Activate and Customize buttons, shown on hover */
</del><ins>+/* Activate and Customize buttons, shown on hover and focus */
</ins><span class="cx"> .theme-browser .theme .theme-actions {
</span><span class="cx">  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
</span><span class="cx">  opacity: 0;
</span><span class="lines">@@ -112,7 +116,9 @@
</span><span class="cx">  border-left: 1px solid rgba(0,0,0,0.05);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser .theme:hover .theme-actions {
</del><ins>+.theme-browser .theme:hover .theme-actions,
+.theme-browser .theme.focus .theme-actions,
+.theme-browser .theme:focus .theme-actions {
</ins><span class="cx">   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
</span><span class="cx">  opacity: 1;
</span><span class="cx"> }
</span><span class="lines">@@ -157,11 +163,13 @@
</span><span class="cx">  transition: opacity 0.2s ease-in-out;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser .theme:hover .theme-screenshot {
</del><ins>+.theme-browser .theme:hover .theme-screenshot,
+.theme-browser .theme:focus .theme-screenshot {
</ins><span class="cx">   background: #fff;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser.rendered .theme:hover .theme-screenshot img {
</del><ins>+.theme-browser.rendered .theme:hover .theme-screenshot img,
+.theme-browser.rendered .theme:focus .theme-screenshot img {
</ins><span class="cx">   opacity: 0.4;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -189,14 +197,7 @@
</span><span class="cx"> .theme-browser .theme:focus {
</span><span class="cx">  outline: 1px dotted #222;
</span><span class="cx"> }
</span><del>-/* Hide shortcut actions and hover feedback when using tab navigation */
-.theme-browser .theme:focus .theme-actions {
-       display: none;
-}
-/* Restore display of theme controls if you hover a focused theme */
-.theme-browser .theme:focus:hover .theme-actions {
-       display: block;
-}
</del><ins>+
</ins><span class="cx"> .theme-browser .theme:focus .more-details {
</span><span class="cx">  opacity: 1;
</span><span class="cx"> }
</span><span class="lines">@@ -205,7 +206,8 @@
</span><span class="cx">  display: block;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser.rendered .theme:hover .more-details {
</del><ins>+.theme-browser.rendered .theme:hover .more-details,
+.theme-browser.rendered .theme:focus .more-details {
</ins><span class="cx">   -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
</span><span class="cx">  opacity: 1;
</span><span class="cx"> }
</span><span class="lines">@@ -359,16 +361,19 @@
</span><span class="cx">  text-indent: 4px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser .theme.add-new-theme:hover .theme-screenshot {
</del><ins>+.theme-browser .theme.add-new-theme:hover .theme-screenshot,
+.theme-browser .theme.add-new-theme:focus .theme-screenshot {
</ins><span class="cx">   background: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser .theme.add-new-theme:hover span:after {
</del><ins>+.theme-browser .theme.add-new-theme:hover span:after,
+.theme-browser .theme.add-new-theme:focus span:after {
</ins><span class="cx">   background: #fff;
</span><span class="cx">  color: #0074a2;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser .theme.add-new-theme:hover:after {
</del><ins>+.theme-browser .theme.add-new-theme:hover:after,
+.theme-browser .theme.add-new-theme:focus:after {
</ins><span class="cx">   border-color: transparent;
</span><span class="cx">  color: #fff;
</span><span class="cx">  background: #0074a2;
</span><span class="lines">@@ -387,7 +392,8 @@
</span><span class="cx">  margin-bottom: 10%;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.theme-browser .theme.add-new-theme:hover .theme-name {
</del><ins>+.theme-browser .theme.add-new-theme:hover .theme-name,
+.theme-browser .theme.add-new-theme:focus .theme-name {
</ins><span class="cx">   color: #fff;
</span><span class="cx">  z-index: 2;
</span><span class="cx"> }
</span><span class="lines">@@ -954,11 +960,14 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  .theme:not(.active):hover .theme-actions,
</span><del>-       .theme:hover .more-details {
</del><ins>+        .theme:not(.active):focus .theme-actions,
+       .theme:hover .more-details,
+       .theme:focus .more-details {
</ins><span class="cx">           display: none;
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       .theme-browser.rendered .theme:hover .theme-screenshot img {
</del><ins>+        .theme-browser.rendered .theme:hover .theme-screenshot img,
+       .theme-browser.rendered .theme:focus .theme-screenshot img {
</ins><span class="cx">           opacity: 1.0;
</span><span class="cx">  }
</span><span class="cx"> }
</span><span class="lines">@@ -1163,12 +1172,22 @@
</span><span class="cx"> }
</span><span class="cx"> body.more-filters-opened .more-filters,
</span><span class="cx"> body.more-filters-opened .more-filters:before {
</span><del>-       background: rgb(46, 162, 204);
</del><ins>+        background: #777;
</ins><span class="cx">   -webkit-border-radius: 2px;
</span><span class="cx">  border-radius: 2px;
</span><span class="cx">  border: none;
</span><span class="cx">  color: #fff;
</span><ins>+       -webkit-transition: color .1s ease-in, background .1s ease-in;
+       transition: color .1s ease-in, background .1s ease-in;
</ins><span class="cx"> }
</span><ins>+
+body.more-filters-opened .more-filters:hover,
+body.more-filters-opened .more-filters:focus,
+body.more-filters-opened .more-filters:hover:before,
+body.more-filters-opened .more-filters:focus:before {
+       background: rgb(46, 162, 204);
+}
+
</ins><span class="cx"> .theme-install-php .theme-search {
</span><span class="cx">  position: absolute;
</span><span class="cx">  right: 10px;
</span></span></pre></div>
<a id="trunksrcwpadminjsthemejs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/theme.js (27803 => 27804)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/theme.js   2014-03-28 03:01:43 UTC (rev 27803)
+++ trunk/src/wp-admin/js/theme.js      2014-03-28 03:15:30 UTC (rev 27804)
</span><span class="lines">@@ -235,6 +235,7 @@
</span><span class="cx">          'click .preview': 'preview',
</span><span class="cx">          'keydown': themes.isInstall ? 'preview': 'expand',
</span><span class="cx">          'touchend': themes.isInstall ? 'preview': 'expand',
</span><ins>+               'keyup': 'addFocus',
</ins><span class="cx">           'touchmove': 'preventExpand'
</span><span class="cx">  },
</span><span class="cx"> 
</span><span class="lines">@@ -264,6 +265,14 @@
</span><span class="cx">          }
</span><span class="cx">  },
</span><span class="cx"> 
</span><ins>+       // Add class of focus to the theme we are focused on.
+       addFocus: function() {
+               var $themeToFocus = ( $( ':focus' ).hasClass( 'theme' ) ) ? $( ':focus' ) : $(':focus').parents('.theme');
+
+               $('.theme.focus').removeClass('focus');
+               $themeToFocus.addClass('focus');
+       },
+
</ins><span class="cx">   // Single theme overlay screen
</span><span class="cx">  // It's shown when clicking a theme
</span><span class="cx">  expand: function( event ) {
</span><span class="lines">@@ -303,6 +312,16 @@
</span><span class="cx">                  return this.touchDrag = false;
</span><span class="cx">          }
</span><span class="cx"> 
</span><ins>+               // 'enter' and 'space' keys expand the details view when a theme is :focused
+               if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) {
+                       return;
+               }
+
+               // pressing enter while focused on the buttons shouldn't open the preview
+               if ( event.type === 'keydown' && event.which !== 13 && $( ':focus' ).hasClass( 'button' ) ) {
+                       return;
+               }
+
</ins><span class="cx">           event.preventDefault();
</span><span class="cx"> 
</span><span class="cx">          event = event || window.event;
</span><span class="lines">@@ -932,6 +951,12 @@
</span><span class="cx"> 
</span><span class="cx">  // Handles Ajax request for searching through themes in public repo
</span><span class="cx">  search: function( event ) {
</span><ins>+
+               // Tabbing or reverse tabbing into the search input shouldn't trigger a search
+               if ( event.type === 'keyup' && ( event.which === 9 || event.which === 16 ) ) {
+                       return;
+               }
+
</ins><span class="cx">           this.collection = this.options.parent.view.collection;
</span><span class="cx"> 
</span><span class="cx">          // Clear on escape.
</span><span class="lines">@@ -1085,6 +1110,8 @@
</span><span class="cx">          var $el = $( event.target ),
</span><span class="cx">                  sort = $el.data( 'sort' );
</span><span class="cx"> 
</span><ins>+               event.preventDefault();
+
</ins><span class="cx">           // Bail if this is already active
</span><span class="cx">          if ( $el.hasClass( this.activeClass ) ) {
</span><span class="cx">                  return;
</span></span></pre></div>
<a id="trunksrcwpadminthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/theme-install.php (27803 => 27804)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/theme-install.php     2014-03-28 03:01:43 UTC (rev 27803)
+++ trunk/src/wp-admin/theme-install.php        2014-03-28 03:15:30 UTC (rev 27804)
</span><span class="lines">@@ -104,8 +104,8 @@
</span><span class="cx"> <div class="wrap">
</span><span class="cx">  <h2>
</span><span class="cx">          <?php echo esc_html( $title ); ?>
</span><del>-               <a class="upload add-new-h2"><?php _e( 'Upload Theme' ); ?></a>
-               <a class="browse-themes add-new-h2"><?php _ex( 'Browse', 'themes' ); ?></a>
</del><ins>+                <a href="#" class="upload add-new-h2"><?php _e( 'Upload Theme' ); ?></a>
+               <a href="#" class="browse-themes add-new-h2"><?php _ex( 'Browse', 'themes' ); ?></a>
</ins><span class="cx">   </h2>
</span><span class="cx"> 
</span><span class="cx">  <div class="upload-theme">
</span><span class="lines">@@ -114,13 +114,13 @@
</span><span class="cx"> 
</span><span class="cx">  <div class="theme-navigation">
</span><span class="cx">          <span class="theme-count"></span>
</span><del>-               <span class="theme-section current" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></span>
-               <span class="theme-section" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></span>
-               <span class="theme-section" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></span>
</del><ins>+                <a class="theme-section current" href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a>
+               <a class="theme-section" href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a>
+               <a class="theme-section" href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a>
</ins><span class="cx">           <div class="theme-top-filters">
</span><span class="cx">                  <!--<span class="theme-filter" data-filter="photoblogging">Photography</span>
</span><span class="cx">                  <span class="theme-filter" data-filter="responsive-layout">Responsive</span>-->
</span><del>-                       <span class="more-filters"><?php _e( 'Feature Filter' ); ?></span>
</del><ins>+                        <a class="more-filters" href="#"><?php _e( 'Feature Filter' ); ?></a>
</ins><span class="cx">           </div>
</span><span class="cx">          <div class="more-filters-container">
</span><span class="cx">          <?php
</span></span></pre>
</div>
</div>

</body>
</html>