Commit 69851257669 for woocommerce
commit 69851257669820e286def0925457c1e0bbdc3742
Author: Luigi Teschio <gigitux@gmail.com>
Date: Tue Sep 8 11:21:07 2026 +0200
Fix short description editor restoration after metabox moves (#68433)
* Fix short description editor restoration after metabox moves
* Add changelog entry for short description editor restoration
diff --git a/plugins/woocommerce/changelog/fix-32113-short-description-pagehide b/plugins/woocommerce/changelog/fix-32113-short-description-pagehide
new file mode 100644
index 00000000000..204b45a6269
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-32113-short-description-pagehide
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix the product short description editor becoming blank after moving its metabox.
diff --git a/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js b/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js
index 3fcf4f97230..634c20a7411 100644
--- a/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js
+++ b/plugins/woocommerce/client/legacy/js/admin/meta-boxes-product.js
@@ -1,4 +1,46 @@
/*global woocommerce_admin_meta_boxes, _ */
+jQuery( document ).on( 'tinymce-editor-init', function ( event, editor ) {
+ if ( 'excerpt' !== editor.id ) {
+ return;
+ }
+
+ editor.getWin().addEventListener(
+ 'pagehide',
+ function () {
+ const textarea = editor.getElement();
+ const restoreVisualMode = ! editor.isHidden();
+
+ // Moving the iframe unloads its document. Save before that document is lost.
+ if ( restoreVisualMode ) {
+ editor.save();
+ }
+ const content = textarea.value;
+
+ window.setTimeout( function () {
+ if (
+ ! document.body.contains( textarea ) ||
+ window.tinymce.get( 'excerpt' ) !== editor
+ ) {
+ return;
+ }
+
+ editor.remove();
+ // Removing a hidden editor can overwrite newer Text-mode content.
+ textarea.value = content;
+ textarea.removeAttribute( 'aria-hidden' );
+
+ // WordPress initializes Text-mode editors when the Visual tab is selected.
+ if ( restoreVisualMode ) {
+ window.tinymce.init(
+ window.tinyMCEPreInit.mceInit.excerpt
+ );
+ }
+ } );
+ },
+ { once: true }
+ );
+} );
+
jQuery( function ( $ ) {
let isPageUnloading = false;