WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#33943 closed defect (bug) (fixed)

Changeset 34095 and 34180 from recent 4.3.1 update breaks comment table layout

Reported by: becki Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.3.1
Component: Comments Keywords: has-patch
Focuses: javascript Cc:

Description

hello there,

i'm using the latest wp 4.3.1 and discovered a bug with my wordpress setup. i'm using wordpress as some sort of documentation system and users can submit optional info when posting a comment.

this optional info is appended to the comment and displayed as a table when viewing comments in the admin panel -> /wp-admin/edit-comments.php (see screenshot attachments).

with the most recent update to 4.3.1 and changes to /wp-admin/js/edit-comments.js it breaks the layout of the comment table with my sort of special setup.

the changesets affecting my setup:

https://core.trac.wordpress.org/changeset/34095/branches/4.3
https://core.trac.wordpress.org/changeset/34180/branches/4.3

this line in edit-comments.js counts the <th> and <td>

colspanVal = $( 'th:visible, td:visible', c ).length; 

and then adds it to the edit row

		if ( editRow.hasClass( 'inline-edit-row' ) && 0 !== colspanVal ) {
			$( 'td', editRow ).attr( 'colspan', colspanVal );
		}

in my case it counts all the <th> and <td> from the optional info table appended to the comment and then sets a colspan value of 24 to the #replyrow, which finally breaks the layout of the comment table, (see screenshot attachments)

if there's no info table appended to the comment then all is working fine.

for the moment being, to get things working again for my client, i changed the jquery selector to NOT count the <th> and <td> of my optional info table with a class of .timeSheetEntries

colspanVal = $( 'th:visible table:not(".timeSheetEntries"), td:visible table:not(".timeSheetEntries")', c ).length;

so, all is working fine again with my workaround but i'm not sure on how to properly solve this issue? as i don't want to do the change on each worpdress update!

What would be the proper way to handle this issue? should i display my data appended to the comment in a non <table> way? can we update the jquery to not match the table appended to the comment?

what would be the best way?

thanks, greetings & all the best
becki

Attachments (4)

wordpress-trac-01.jpg (44.3 KB) - added by becki 6 years ago.
wordpress-trac-02.jpg (201.7 KB) - added by becki 6 years ago.
wordpress-trac-03.jpg (73.0 KB) - added by becki 6 years ago.
wordpress-trac-04.jpg (278.8 KB) - added by becki 6 years ago.

Download all attachments as: .zip

Change History (10)

#1 follow-up: @swissspidy
6 years ago

with the most recent update to 4.3.1 it breaks the layout of the comment table with my sort of special setup.

To simplify this: Does this break the list table in general when there's a table in the comment content and not just your custom setup?

#2 in reply to: ↑ 1 @becki
6 years ago

Replying to swissspidy:

with the most recent update to 4.3.1 it breaks the layout of the comment table with my sort of special setup.

To simplify this: Does this break the list table in general when there's a table in the comment content and not just your custom setup?

yes, just added a comment with a table and 4 data cells on a blank wordpress install without my special setup and it also breaks the list table layout. see attachment wordpress-trac-04.jpg

#3 @rmccue
6 years ago

  • Version changed from 4.3 to 4.3.1

#4 @wonderboymusic
6 years ago

  • Keywords needs-patch added

#5 @wonderboymusic
6 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Review to 4.4
  • Owner set to wonderboymusic
  • Status changed from new to assigned

#6 @wonderboymusic
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34527:

Comments List Table: after [34179], scope the <th>s and <td>s as direct descendants of their parent row.

Fixes #33943.

Note: See TracTickets for help on using tickets.