[wp-trac] [WordPress Trac] #49262: Image cropping unresponsive when adding media into a post and then click on Edit Image

WordPress Trac noreply at wordpress.org
Mon Feb 3 23:57:05 UTC 2020


#49262: Image cropping unresponsive when adding media into a post and then click on
Edit Image
---------------------------+------------------------------
 Reporter:  antonioromano  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Media          |     Version:  5.3.2
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  ui
---------------------------+------------------------------

Comment (by azaozz):

 Confirmed. Steps to reproduce (somewhat inconsistently):

 - Go to the classic editor.
 - Drag and drop an image on the editor to upload is (not from the media
 modal). This opens the media modal and the image is uploaded as if it was
 dropped there.
 - Select "Edit Image" from the media modal sidebar (under the thumbnail).
 - Click on the image preview in the image editor and drag to select a
 region for cropping.

 At this point the region is selected properly but the selection in not
 "interactive", i.e. it cannot be moved or resized.

 This happens only the first time when following the above steps. If the
 media modal or the image editor is reset in any way, for example clicking
 on the "Back" button and then again on "Edit Image", the selection works
 properly.

 Looking further, seems caused by improper initialization of
 imgareaselect.js. That seems related to Backbone.js as `imgLoaded()` in
 image-edit.js is called twice. The initialization call is pretty odd,
 triggered by an inline `onload="imageEdit.imgLoaded('<?php echo $post_id;
 ?>')"` in the img tag. For some reason that `onload` js runs twice.

 Fixing it looks as simple as ensuring imgareaselect.js is not initialized
 twice in a row, but will need testing in all instances/places the script
 is used.

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


More information about the wp-trac mailing list