<!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>[38709] trunk/src: Customize: Improve the widgets and menu items search.</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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/38709">38709</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/38709","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>afercia</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-10-03 16:27:55 +0000 (Mon, 03 Oct 2016)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Customize: Improve the widgets and menu items search.
- adds a "search" icon into the search fields
- adds a hidden description for the widget search field, targeted by `aria-describedby`
- adds the "clear-results" button to the widgets search
- removes the `change` and `search` events bound on the widget search, for these "live searches" WordPress should standardize on `input` (+ `keyup` when needed)
- adds property and function to keep track and update the number of the widgets search results
- the widgets search results are now announced via `wp.a11y.speak()`
- adds a visible and audible message when there are no widgets search results
- moves some CSS to `customize-controls.css`
Props ryankienstra, melchoyce, afercia.
Fixes <a href="https://core.trac.wordpress.org/ticket/36908">#36908</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsscustomizecontrolscss">trunk/src/wp-admin/css/customize-controls.css</a></li>
<li><a href="#trunksrcwpadmincsscustomizenavmenuscss">trunk/src/wp-admin/css/customize-nav-menus.css</a></li>
<li><a href="#trunksrcwpadminjscustomizenavmenusjs">trunk/src/wp-admin/js/customize-nav-menus.js</a></li>
<li><a href="#trunksrcwpadminjscustomizewidgetsjs">trunk/src/wp-admin/js/customize-widgets.js</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizenavmenusphp">trunk/src/wp-includes/class-wp-customize-nav-menus.php</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizewidgetsphp">trunk/src/wp-includes/class-wp-customize-widgets.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsscustomizecontrolscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/customize-controls.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/customize-controls.css 2016-10-03 08:37:27 UTC (rev 38708)
+++ trunk/src/wp-admin/css/customize-controls.css 2016-10-03 16:27:55 UTC (rev 38709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1409,21 +1409,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> overflow: auto;
</span><span class="cx" style="display: block; padding: 0 10px"> bottom: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ border-top: 1px solid #ddd;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.no-widgets-found #available-widgets-list {
+ border-top: none;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> #available-widgets-filter {
</span><span class="cx" style="display: block; padding: 0 10px"> position: fixed;
</span><span class="cx" style="display: block; padding: 0 10px"> top: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> z-index: 1;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 300px;
</span><span class="cx" style="display: block; padding: 0 10px"> background: #eee;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- border-bottom: 1px solid #e5e5e5;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* search field container */
</span><span class="cx" style="display: block; padding: 0 10px"> #available-widgets-filter,
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items-search .accordion-section-title {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- padding: 12px 15px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ padding: 13px 15px;
</ins><span class="cx" style="display: block; padding: 0 10px"> -webkit-box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> -moz-box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1431,10 +1435,103 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #available-widgets-filter input,
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items-search input {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- padding: 6px 10px;
</del><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ height: 32px;
+ margin: 1px 0;
+ padding: 6px 30px;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#available-widgets-filter input::-ms-clear,
+#available-menu-items-search input::-ms-clear {
+ display: none; /* remove the "x" in IE, which conflicts with the "x" icon on button.clear-results */
+}
+
+#available-menu-items-search .search-icon,
+#available-widgets-filter .search-icon {
+ display: block;
+ position: absolute;
+ top: 15px; /* 13 container padding +1 input margin +1 input border */
+ left: 16px;
+ width: 30px;
+ height: 30px;
+ line-height: 28px;
+ text-align: center;
+ color: #72777c;
+}
+
+#available-widgets-filter .clear-results,
+#available-menu-items-search .clear-results {
+ position: absolute;
+ top: 15px; /* 13 container padding +1 input margin +1 input border */
+ right: 16px;
+ width: 30px;
+ height: 30px;
+ padding: 0;
+ border: 0;
+ cursor: pointer;
+ background: none;
+ color: #a00;
+ text-decoration: none;
+ outline: 0;
+}
+
+#available-widgets-filter .clear-results,
+#available-menu-items-search .clear-results,
+#available-menu-items-search.loading .clear-results.is-visible {
+ display: none;
+}
+
+#available-widgets-filter .clear-results.is-visible,
+#available-menu-items-search .clear-results.is-visible {
+ display: block;
+}
+
+#available-widgets-filter .clear-results:before,
+#available-menu-items-search .clear-results:before {
+ content: "\f335";
+ font: normal 20px/1 dashicons;
+ vertical-align: middle;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+#available-widgets-filter .clear-results:hover,
+#available-widgets-filter .clear-results:focus,
+#available-menu-items-search .clear-results:hover,
+#available-menu-items-search .clear-results:focus {
+ color: #dc3232;
+}
+
+#available-widgets-filter .clear-results:focus,
+#available-menu-items-search .clear-results:focus {
+ -webkit-box-shadow:
+ 0 0 0 1px #5b9dd9,
+ 0 0 2px 1px rgba(30, 140, 190, .8);
+ box-shadow:
+ 0 0 0 1px #5b9dd9,
+ 0 0 2px 1px rgba(30, 140, 190, .8);
+}
+
+#available-menu-items-search .search-icon:after,
+#available-widgets-filter .search-icon:after {
+ content: "\f179";
+ font: normal 20px/1 dashicons;
+ vertical-align: middle;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.no-widgets-found-message {
+ display: none;
+ margin: 0;
+ padding: 0 15px;
+ line-height: inherit;
+}
+
+.no-widgets-found .no-widgets-found-message {
+ display: block;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> #available-widgets .widget-top,
</span><span class="cx" style="display: block; padding: 0 10px"> #available-widgets .widget-top:hover,
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items .item-top,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1450,7 +1547,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> position: relative;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 20px 15px 20px 60px;
</span><span class="cx" style="display: block; padding: 0 10px"> background: #fff;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- border-bottom: 1px solid #e5e5e5;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ border-bottom: 1px solid #ddd;
</ins><span class="cx" style="display: block; padding: 0 10px"> border-left: 4px solid #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> cursor: pointer;
</span><span class="cx" style="display: block; padding: 0 10px"> display: none;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1628,12 +1725,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> #available-widgets-filter {
</span><span class="cx" style="display: block; padding: 0 10px"> position: relative;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- background: #fff;
</del><span class="cx" style="display: block; padding: 0 10px"> height: auto;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- padding: 10px 15px;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #available-widgets-list {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- top: 140px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ top: 130px;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ #available-menu-items-search .clear-results,
+ #available-menu-items-search .search-icon {
+ top: 85px; /* 70 section title height + 13 container padding +1 input margin +1 input border */
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadmincsscustomizenavmenuscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/customize-nav-menus.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/customize-nav-menus.css 2016-10-03 08:37:27 UTC (rev 38708)
+++ trunk/src/wp-admin/css/customize-nav-menus.css 2016-10-03 16:27:55 UTC (rev 38709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -688,58 +688,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0 20px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#available-menu-items-search .clear-results {
- position: absolute;
- top: 18px; /* 12 container padding +1 input margin +1 input border +4 ( 4 is ( 28 input height - 20 button height ) / 2 ) */
- right: 20px;
- width: 20px;
- height: 20px;
- padding: 0;
- border: 0;
- cursor: pointer;
- background: none;
- color: #a00;
- text-decoration: none;
- outline: 0;
-}
-
-#available-menu-items-search .clear-results,
-#available-menu-items-search.loading .clear-results.is-visible {
- display: none;
-}
-
-#available-menu-items-search .clear-results.is-visible {
- display: block;
-}
-
-.ie8 #available-menu-items-search.loading .clear-results:before {
- content: ""; /* help IE8 redraw the pseudo element */
-}
-
-#available-menu-items-search .clear-results:before {
- content: "\f335";
- font: normal 20px/1 dashicons;
- vertical-align: middle;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-#available-menu-items-search .clear-results:hover,
-#available-menu-items-search .clear-results:focus {
- color: #f00;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items-search .spinner {
</span><span class="cx" style="display: block; padding: 0 10px"> position: absolute;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- top: 18px; /* 12 container padding +1 input margin +1 input border +4 ( ( 28 input height - 20 button height ) / 2 ) */
- right: 20px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ top: 20px; /* 13 container padding +1 input margin +6 ( ( 32 input height - 20 spinner height ) / 2 ) */
+ right: 21px;
</ins><span class="cx" style="display: block; padding: 0 10px"> margin: 0 !important;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* search results list */
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items #available-menu-items-search .accordion-section-content {
</span><span class="cx" style="display: block; padding: 0 10px"> position: absolute;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- left: 1px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left: 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> top: 60px; /* below title div / search input */
</span><span class="cx" style="display: block; padding: 0 10px"> bottom: 0px; /* 100% height that still triggers lazy load */
</span><span class="cx" style="display: block; padding: 0 10px"> max-height: none;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -750,6 +709,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-sizing: border-box;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#available-menu-items-search .nothing-found {
+ /* Compensate the 1px top padding of the container. */
+ margin-top: -1px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items-search .accordion-section-title:after {
</span><span class="cx" style="display: block; padding: 0 10px"> display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -920,7 +884,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .customize-screen-options-toggle:focus:before,
</span><span class="cx" style="display: block; padding: 0 10px"> #customize-controls .customize-info .customize-help-toggle:focus:before,
</span><span class="cx" style="display: block; padding: 0 10px"> .wp-customizer button:focus .toggle-indicator:after,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-#available-menu-items-search .clear-results:focus,
</del><span class="cx" style="display: block; padding: 0 10px"> .menu-delete:focus,
</span><span class="cx" style="display: block; padding: 0 10px"> .menu-item-bar .item-delete:focus:before,
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items .item-add:focus:before {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -937,19 +900,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items #available-menu-items-search .accordion-section-content {
</span><span class="cx" style="display: block; padding: 0 10px"> top: 63px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- #available-menu-items-search .spinner,
- #available-menu-items-search .clear-results {
- top: 20px; /* 12 container padding +1 input margin +1 input border +5.5 ( 5.5 rounded to 6 is ( 31 input height - 20 button height ) / 2 ) */
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> @media screen and ( max-width: 640px ) {
</span><span class="cx" style="display: block; padding: 0 10px"> #available-menu-items #available-menu-items-search .accordion-section-content {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- top: 133px;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ top: 130px;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- #available-menu-items-search .clear-results {
- top: 90px; /* 70 section title height + 12 container padding +1 input margin +1 input border +5.5 ( 5.5 rounded to 6 is ( 31 input height - 20 button height ) / 2 ) */
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminjscustomizenavmenusjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/customize-nav-menus.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/customize-nav-menus.js 2016-10-03 08:37:27 UTC (rev 38708)
+++ trunk/src/wp-admin/js/customize-nav-menus.js 2016-10-03 16:27:55 UTC (rev 38709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -170,6 +170,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> currentMenuControl: null,
</span><span class="cx" style="display: block; padding: 0 10px"> debounceSearch: null,
</span><span class="cx" style="display: block; padding: 0 10px"> $search: null,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $clearResults: null,
</ins><span class="cx" style="display: block; padding: 0 10px"> searchTerm: '',
</span><span class="cx" style="display: block; padding: 0 10px"> rendered: false,
</span><span class="cx" style="display: block; padding: 0 10px"> pages: {},
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -185,6 +186,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.$search = $( '#menu-items-search' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.$clearResults = this.$el.find( '.clear-results' );
</ins><span class="cx" style="display: block; padding: 0 10px"> this.sectionContent = this.$el.find( '.available-menu-items-list' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.debounceSearch = _.debounce( self.search, 500 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,8 +204,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Clear the search results.
- $( '.clear-results' ).on( 'click', function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Clear the search results and trigger a `keyup` event to fire a new search.
+ this.$clearResults.on( 'click', function() {
</ins><span class="cx" style="display: block; padding: 0 10px"> self.$search.val( '' ).focus().trigger( 'keyup' );
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -261,11 +263,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $otherSections.fadeOut( 100 );
</span><span class="cx" style="display: block; padding: 0 10px"> $searchSection.find( '.accordion-section-content' ).slideDown( 'fast' );
</span><span class="cx" style="display: block; padding: 0 10px"> $searchSection.addClass( 'open' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $searchSection.find( '.clear-results' ).addClass( 'is-visible' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.$clearResults.addClass( 'is-visible' );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else if ( '' === event.target.value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $searchSection.removeClass( 'open' );
</span><span class="cx" style="display: block; padding: 0 10px"> $otherSections.show();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $searchSection.find( '.clear-results' ).removeClass( 'is-visible' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.$clearResults.removeClass( 'is-visible' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.searchTerm = event.target.value;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -337,7 +339,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> self.currentRequest.fail(function( data ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // data.message may be undefined, for example when typing slow and the request is aborted.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( data.message ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $content.empty().append( $( '<p class="nothing-found"></p>' ).text( data.message ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content.empty().append( $( '<li class="nothing-found"></li>' ).text( data.message ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> wp.a11y.speak( data.message );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> self.pages.search = -1;
</span></span></pre></div>
<a id="trunksrcwpadminjscustomizewidgetsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/customize-widgets.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/customize-widgets.js 2016-10-03 08:37:27 UTC (rev 38708)
+++ trunk/src/wp-admin/js/customize-widgets.js 2016-10-03 16:27:55 UTC (rev 38709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -70,8 +70,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.search( this.terms );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If search is blank, show all themes
- // Useful for resetting the views when you clean the input
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If search is blank, set all the widgets as they matched the search to reset the views.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( this.terms === '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> this.each( function ( widget ) {
</span><span class="cx" style="display: block; padding: 0 10px"> widget.set( 'search_matched', true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -149,8 +148,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> events: {
</span><span class="cx" style="display: block; padding: 0 10px"> 'input #widgets-search': 'search',
</span><span class="cx" style="display: block; padding: 0 10px"> 'keyup #widgets-search': 'search',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'change #widgets-search': 'search',
- 'search #widgets-search': 'search',
</del><span class="cx" style="display: block; padding: 0 10px"> 'focus .widget-tpl' : 'focus',
</span><span class="cx" style="display: block; padding: 0 10px"> 'click .widget-tpl' : '_submit',
</span><span class="cx" style="display: block; padding: 0 10px"> 'keypress .widget-tpl' : '_submit',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,18 +160,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Cache sidebar control which has opened panel
</span><span class="cx" style="display: block; padding: 0 10px"> currentSidebarControl: null,
</span><span class="cx" style="display: block; padding: 0 10px"> $search: null,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $clearResults: null,
+ searchMatchesCount: null,
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> initialize: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> var self = this;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.$search = $( '#widgets-search' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.$clearResults = this.$el.find( '.clear-results' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> _.bindAll( this, 'close' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.listenTo( this.collection, 'change', this.updateList );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.updateList();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Set the initial search count to the number of available widgets.
+ this.searchMatchesCount = this.collection.length;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // If the available widgets panel is open and the customize controls are
</span><span class="cx" style="display: block; padding: 0 10px"> // interacted with (i.e. available widgets panel is blurred) then close the
</span><span class="cx" style="display: block; padding: 0 10px"> // available widgets panel. Also close on back button click.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -185,6 +189,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Clear the search results and trigger a `keyup` event to fire a new search.
+ this.$clearResults.on( 'click', function() {
+ self.$search.val( '' ).focus().trigger( 'keyup' );
+ } );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Close the panel if the URL in the preview changes
</span><span class="cx" style="display: block; padding: 0 10px"> api.previewer.bind( 'url', this.close );
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -194,6 +203,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var firstVisible;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> this.collection.doSearch( event.target.value );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Update the search matches count.
+ this.updateSearchMatchesCount();
+ // Announce how many search results.
+ this.announceSearchMatches();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove a widget from being selected if it is no longer visible
</span><span class="cx" style="display: block; padding: 0 10px"> if ( this.selected && ! this.selected.is( ':visible' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -214,8 +227,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.select( firstVisible );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Toggle the clear search results button.
+ if ( '' !== event.target.value ) {
+ this.$clearResults.addClass( 'is-visible' );
+ } else if ( '' === event.target.value ) {
+ this.$clearResults.removeClass( 'is-visible' );
+ }
+
+ // Set a CSS class on the search container when there are no search results.
+ if ( ! this.searchMatchesCount ) {
+ this.$el.addClass( 'no-widgets-found' );
+ } else {
+ this.$el.removeClass( 'no-widgets-found' );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Update the count of the available widgets that have the `search_matched` attribute.
+ updateSearchMatchesCount: function() {
+ this.searchMatchesCount = this.collection.where({ search_matched: true }).length;
+ },
+
+ // Send a message to the aria-live region to announce how many search results.
+ announceSearchMatches: _.debounce( function() {
+ var message = l10n.widgetsFound.replace( '%d', this.searchMatchesCount ) ;
+
+ if ( ! this.searchMatchesCount ) {
+ message = l10n.noWidgetsFound;
+ }
+
+ wp.a11y.speak( message );
+ }, 500 ),
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Changes visibility of available widgets
</span><span class="cx" style="display: block; padding: 0 10px"> updateList: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> this.collection.each( function( widget ) {
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizenavmenusphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-customize-nav-menus.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-customize-nav-menus.php 2016-10-03 08:37:27 UTC (rev 38708)
+++ trunk/src/wp-includes/class-wp-customize-nav-menus.php 2016-10-03 16:27:55 UTC (rev 38709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -891,6 +891,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <p class="screen-reader-text" id="menu-items-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p>
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="spinner"></span>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="search-icon" aria-hidden="true"></div>
</ins><span class="cx" style="display: block; padding: 0 10px"> <button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button>
</span><span class="cx" style="display: block; padding: 0 10px"> <ul class="accordion-section-content available-menu-items-list" data-type="search"></ul>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizewidgetsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-customize-widgets.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-customize-widgets.php 2016-10-03 08:37:27 UTC (rev 38708)
+++ trunk/src/wp-includes/class-wp-customize-widgets.php 2016-10-03 16:27:55 UTC (rev 38709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -733,7 +733,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'reorderModeOn' => __( 'Reorder mode enabled' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'reorderModeOff' => __( 'Reorder mode closed' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'reorderLabelOn' => esc_attr__( 'Reorder widgets' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'reorderLabelOff' => esc_attr__( 'Close reorder mode' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'widgetsFound' => __( 'Number of widgets found: %d' ),
+ 'noWidgetsFound' => __( 'No widgets found.' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'tpl' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'widgetReorderNav' => $widget_reorder_nav_tpl,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -777,7 +778,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="available-widgets-filter">
</span><span class="cx" style="display: block; padding: 0 10px"> <label class="screen-reader-text" for="widgets-search"><?php _e( 'Search Widgets' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <input type="search" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets…' ) ?>" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input type="text" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets…' ) ?>" aria-describedby="widgets-search-desc" />
+ <div class="search-icon" aria-hidden="true"></div>
+ <button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button>
+ <p class="screen-reader-text" id="widgets-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="available-widgets-list">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php foreach ( $this->get_available_widgets() as $available_widget ): ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -785,6 +789,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php echo $available_widget['control_tpl']; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endforeach; ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p class="no-widgets-found-message"><?php _e( 'No widgets found.' ); ?></p>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div><!-- #available-widgets-list -->
</span><span class="cx" style="display: block; padding: 0 10px"> </div><!-- #available-widgets -->
</span><span class="cx" style="display: block; padding: 0 10px"> </div><!-- #widgets-left -->
</span></span></pre>
</div>
</div>
</body>
</html>