From 6bf326e9678e76cd9e5507ac66eec77a02fc137c Mon Sep 17 00:00:00 2001 From: Clorith Date: Tue, 6 Sep 2022 22:06:19 +0000 Subject: [PATCH] Site Health: Fix TypeError when copying debug information. In [53164] the `clipboard.js` library was updated to from version 2.0.8 to 2.0.10, and in doing so caused a TypeError JavaScript error to be thrown when the copy button for debug information was used. With the update, the `clipboard.js` library introduced an enhancement to its `.copy()` API, which now removes the fake DOM element used for copying content, which Site Health previously had to remove manually. As this fake DOM element is now removed automatically, the copy function within the debug information screen can rely on the library performing the removal, instead of WordPress needing to do so manually. Props hiren1094, costdev. Fixes #56515. Built from https://develop.svn.wordpress.org/trunk@54089 git-svn-id: http://core.svn.wordpress.org/trunk@53648 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/site-health.js | 4 ---- wp-admin/js/site-health.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/wp-admin/js/site-health.js b/wp-admin/js/site-health.js index 4c6ae5ffa4..9c4ee5c8b7 100644 --- a/wp-admin/js/site-health.js +++ b/wp-admin/js/site-health.js @@ -34,10 +34,6 @@ jQuery( function( $ ) { // Hide success visual feedback after 3 seconds since last success. successTimeout = setTimeout( function() { successElement.addClass( 'hidden' ); - // Remove the visually hidden textarea so that it isn't perceived by assistive technologies. - if ( clipboard.clipboardAction.fakeElem && clipboard.clipboardAction.removeFake ) { - clipboard.clipboardAction.removeFake(); - } }, 3000 ); // Handle success audible feedback. diff --git a/wp-admin/js/site-health.min.js b/wp-admin/js/site-health.min.js index 0f4f43451f..968bb57ef9 100644 --- a/wp-admin/js/site-health.min.js +++ b/wp-admin/js/site-health.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -jQuery(function(o){var a,l=wp.i18n.__,n=wp.i18n._n,r=wp.i18n.sprintf,i=new ClipboardJS(".site-health-copy-buttons .copy-button"),c=o(".health-check-body.health-check-status-tab").length,e=o(".health-check-body.health-check-debug-tab").length,h=o("#health-check-accordion-block-wp-paths-sizes");function u(e){var t,s,a=wp.template("health-check-issue"),i=o("#health-check-issues-"+e.status);!function(e){var t,s,a,i,n={test:"string",label:"string",description:"string"},o=!0;if("object"==typeof e){for(t in n)if("object"==typeof(s=n[t]))for(a in s)i=s[a],void 0!==e[t]&&void 0!==e[t][a]&&i===typeof e[t][a]||(o=!1);else void 0!==e[t]&&s===typeof e[t]||(o=!1);return o}}(e)||(SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],void 0===e.test&&(e.test=e.status+s),"critical"===e.status?t=r(n("%s critical issue","%s critical issues",s),''+s+""):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),0"+e+"

"+t+"

",actions:""};u(wp.hooks.applyFilters("site_status_test_result",e))}function t(){var t=(new Date).getTime(),s=window.setTimeout(function(){wp.a11y.speak(l("Please wait..."))},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),h.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),d(),3e3'+s+""):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),''+s+""):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),''+s+"")),t&&o(".site-health-issue-count-title",i).html(t),0"+e+"

"+t+"

",actions:""};c(wp.hooks.applyFilters("site_status_test_result",e))}function s(){var t=(new Date).getTime(),s=window.setTimeout(function(){wp.a11y.speak(l("Please wait..."))},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),u(),3e3