[wp-trac] [WordPress Trac] #40909: Focus in attachment custom fields is lost when updating the value.

WordPress Trac noreply at wordpress.org
Fri Jul 28 22:07:19 UTC 2017


#40909: Focus in attachment custom fields is lost when updating the value.
--------------------------+------------------------------
 Reporter:  lucymtc       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.7.5
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |     Focuses:
--------------------------+------------------------------

Comment (by lucymtc):

 A temp fix for anyone that needs it is overriding initialize to stop
 listening for re-rendering.

 {{{
 /**
  * Extends wp.media.view.AttachmentCompat
  * Override initialize to stop listening the compat change to
  * prevent re-rendering the attachment compat view.
  * Fixes issue losing focus on atatchment custom fields in the modal.
  */

 var OriginalAttachmentCompat = wp.media.view.AttachmentCompat;
 wp.media.view.AttachmentCompat = OriginalAttachmentCompat.extend({

     initialize: function() {
         OriginalAttachmentCompat.prototype.initialize.apply( this,
 arguments );

         this.stopListening( this.model, 'change:compat', this.render );
     }
 });
 }}}

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


More information about the wp-trac mailing list