Skip to content

Conversation

@louwie17
Copy link
Contributor

@louwie17 louwie17 commented Oct 18, 2022

All Submissions:

Changes proposed in this Pull Request:

Added a product description title to the product text editor, using a similar format as the short description, making use of the postbox styling.
There wasn't an overly clean way to do this aside from doing it through JavaScript, as the edit-form-advanced.php file doesn't provide many filters to wrap the wp_editor in: https://github.com/WordPress/WordPress/blob/master/wp-admin/edit-form-advanced.php#L581-L649
The only options would be to make use of the edit_form_after_title and remove the post_type_supports, but this could break backwards compatibility and the edit_form_after_title does not seem like the right action to use for this.

One side note to my JavaScript implementation, I decided to only append the title html and add a class to handle the remaining styling. I did try to actually wrap the editor html using innerHtml, but this seemed to break the bootstrapping of the editor.

Screen Shot 2022-10-21 at 8 59 16 AM

Screen Shot 2022-10-21 at 8 59 05 AM

cc @jarekmorawski for styling approval, see above two images.

Closes #33538 .

How to test the changes in this Pull Request:

  1. Load this branch and go to Products > Add New and notice how the long description is wrapped in a panel named Product Description
  2. Do the same check for editing an existing product
  3. Now download the Classic Editor plugin and edit an existing post or page and make sure they still look the same.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file for each project being changed, ie pnpm --filter=<project> run changelog add?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@louwie17 louwie17 requested a review from a team October 18, 2022 13:34
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Oct 18, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2022

Test Results Summary

Commit SHA: 0a72fc3

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests19600201980m 55s
E2E Tests186003018919m 25s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

joshuatf
joshuatf previously approved these changes Oct 19, 2022
Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Flashbacks to the old days of jQuery.

Left one question and a minor clean-up comment, but pre-approving as everything is working as described.

The design feels slightly odd and eats into valuable screen real estate on smaller screens, but I'll leave this up to @jarekmorawski to approve.
Screen Shot 2022-10-19 at 4 08 54 PM

margin: 6px 12px 0;
}
#post-status-info {
margin: 0px 12px 12px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have access to our usual scss vars in here? If so we could use gap vars like $gap-small.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it doesn't seem like we do.

@@ -0,0 +1,15 @@
/* global woocommerce_admin_product_editor */
jQuery( function ( $ ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jQuery 💥

wp_enqueue_script( 'wc-admin-product-editor', WC()->plugin_url() . '/assets/js/admin/product-editor' . $suffix . '.js', array( 'jquery' ), $version );

wp_localize_script( 'wc-admin-product-editor', 'woocommerce_admin_product_editor', array(
'i18n_description' => esc_js( __( 'Product Description', 'woocommerce' ) ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a lowercase "D" to match the other field titles on the page:

Suggested change
'i18n_description' => esc_js( __( 'Product Description', 'woocommerce' ) ),
'i18n_description' => esc_js( __( 'Product description', 'woocommerce' ) ),

@jarekmorawski
Copy link

cc @jarekmorawski for styling approval, see above two images.

Can we add a bottom padding to the permalink element, so the space between the product name input field and the description card is maintained? It looks off when they're this close to each other.

The design feels slightly odd and eats into valuable screen real estate on smaller screens, but I'll leave this up to @jarekmorawski to approve.

What about it feels odd to you, Josh? It does take up more space, but not unlike all other cards on the screen. I would keep it as is.

@louwie17 louwie17 force-pushed the update/33538_update_long_description_copy_and_layout branch from d5b624e to 1551091 Compare October 21, 2022 11:53
@louwie17
Copy link
Contributor Author

Thanks @jarekmorawski I updated the screenshots above with the new spacing.

Can we add a bottom padding to the permalink element, so the space between the product name input field and the description card is maintained? It looks off when they're this close to each other.

Instead of add a bottom padding to the permalink, I added a margin to the top of the description meta box. Mostly because this would prevent the Product description to jump down once the permalink becomes visible. This is how the previous design was laid out as well. The extra spacing doesn't appear to be to noticable.

@louwie17
Copy link
Contributor Author

@joshuatf this should be ready for a re-review

@jarekmorawski
Copy link

I agree. It looks good to me!

@louwie17 louwie17 requested a review from joshuatf October 25, 2022 12:10
Copy link
Contributor

@joshuatf joshuatf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the late re-review! LGTM 🚢

What about it feels odd to you, Josh? It does take up more space, but not unlike all other cards on the screen. I would keep it as is.

I suppose because unlike other cards it's an editing experience and on smaller screens could reduce the editor by almost 10%. But if this looks good to you, then it's fine by me. I also think the number of users editing on smaller screens is relatively small.

@jarekmorawski
Copy link

I suppose because unlike other cards it's an editing experience and on smaller screens could reduce the editor by almost 10%. But if this looks good to you, then it's fine by me. I also think the number of users editing on smaller screens is relatively small.

AFAIK it's in single digits. I don't think we need to focus on it too much now. We'll do mobile right in the new UX. 👍

@louwie17 louwie17 merged commit 6b6a332 into trunk Oct 28, 2022
@louwie17 louwie17 deleted the update/33538_update_long_description_copy_and_layout branch October 28, 2022 17:18
@github-actions github-actions bot added this to the 7.2.0 milestone Oct 28, 2022
@github-actions
Copy link
Contributor

Hi @louwie17, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Product creation experience: improve the "add media" and "add contact form" CTA in the long description

4 participants