[wp-trac] [WordPress Trac] #37750: Cropping custom logo should preserve attachment properties

WordPress Trac noreply at wordpress.org
Wed Mar 23 00:29:53 UTC 2022


#37750: Cropping custom logo should preserve attachment properties
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  joedolson
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  6.0
Component:  Media                                |     Version:  4.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-        |     Focuses:
  screenshots                                    |  accessibility
-------------------------------------------------+-------------------------
Changes (by ironprogrammer):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests has-
     screenshots


Comment:

 Thank you for the patch, @antonvlasenko!

 == Test Report

 For [https://github.com/WordPress/wordpress-develop/pull/2441 PR 2441].
 Sincere apologies for stomach grumbles caused by these test images 😋

 === Env
 * WordPress 6.0-alpha-52448-src
 * Chrome 99.0.4844.74
 * macOS 12.3 (Monterey)
 * Theme: Twenty Twenty-One
 * Gutenberg DISABLED 🔴

 === Steps to Test
 1. Activate a non-block theme like **Twenty Twenty-One**.
 2. Navigate to ''Media > Library''.
 3. Upload a new image to the media library, at least 512x512 pixels in
 size.
 4. Set attachment properties for ''Alternative Text'', ''Title'',
 ''Caption'', and ''Description''.
 5. Go to the ''Appearance > Customize''.
 6. Select **Site Identity**, and under the **Logo** section, click "Select
 Logo".
 7. Select the image just uploaded.
 8. Click the "Select" button to open the crop tool.
 9. Select the region to crop, and click the "Crop image" button.
 10. Click "Publish"* and close the Customizer.
 11. Navigate to ''Media > Library''.
 12. Select the latest image added (the cropped logo).
 13. Observe that the ''Alt Text'', ''Title'', ''Caption'', and
 ''Description'' previously set are populated in the **Attachment Details**
 sidebar. ✅
 14. Repeat steps 2-3.
 15. Reset all attachment properties (clear all fields).
 16. Go to the ''Appearance > Customize''.
 17. Select **Site Identity**, and under the **Logo** section, click
 "Change Logo".
 18. Repeat steps 7-12.
 19. Observe that ''Title'' contains the **name** of the cropped file, and
 that ''Description'' contains the **URL** of the cropped file. The other
 two fields remain empty. ✅

 (* NB: you do not need to publish for this test, but it avoids popups and
 revision notices in subsequent steps.)

 === Expected Results (✅)
 - **Attachment Details** attributes are preserved when set on the source
 image.✅
 - When attributes are blank, the ''Title'' and ''Description'' attributes
 are automatically set to the cropped file **name** and **URL**,
 respectively.✅

 === Screenshots
   [[Image(https://cldup.com/RUxY0udTup.png)]]
   ''Original uploaded image (Step 3).''

   [[Image(https://cldup.com/3zwaAryoSI.png)]]
   ''Cropped logo image retains attributes (Step 13).''

   [[Image(https://cldup.com/KEjaIbr00c.png)]]
   ''Image with cleared attributes (Step 15).''

   [[Image(https://cldup.com/DkvvJMfaay.png)]]
   ''Cropped logo image defaults Title and Description to name and URL
 (Step 19).''

 === Additional Notes
 This PR preserves attachment details for the Customizer's **Logo** crops,
 but crops to the **Site Icon** do not retain those attributes -- the
 system exhibits the same behavior as in Step 19 above. This is out of
 scope for the reported issue, but worth noting here.

   [[Image(https://cldup.com/A6Fmgaq4Hw.png)]]
   ''Crop for **Site Icon** does not retain attributes from original image
 (**Additional Notes**).''

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/37750#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list