[wp-trac] [WordPress Trac] #46963: Comments meta box offset bug for custom comment types

WordPress Trac noreply at wordpress.org
Wed Apr 17 13:13:40 UTC 2019

#46963: Comments meta box offset bug for custom comment types
 Reporter:  mikejolley      |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
 There is a conflict in the 'comments' meta box when used in combination
 with custom comment types.

 The `Show more comments` link loads duplicates, without an offset due to
 this line of code:


 this.st = jQuery('#the-comment-list tr.comment:visible').length;

 For custom comment types, the `comment` class may not exist. See how
 comment classes are generated here:


 $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' :

 You can see an example of this with WooCommerce which uses a comment type
 named 'review' (https://github.com/woocommerce/woocommerce/issues/23313).
 Because the comments out output without the `comment` class and instead
 they have a `review` class, the JS code fails to set the correct offset.

 Possible solutions:

 - Output `comment` class for custom comment types in addition to their
 custom class.
 - Revise jquery selector to be more generic e.g. count the `tr` elements

Ticket URL: <https://core.trac.wordpress.org/ticket/46963>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list