[wp-trac] [WordPress Trac] #25473: wp_text_diff creates wrong number of columns if title arguments are set

WordPress Trac noreply at wordpress.org
Sun May 12 12:33:08 UTC 2019


#25473: wp_text_diff creates wrong number of columns if title arguments are set
-------------------------------------+-----------------------------
 Reporter:  joedolson                |       Owner:  (none)
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  Future Release
Component:  Revisions                |     Version:  3.6.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:  accessibility
-------------------------------------+-----------------------------
Changes (by afercia):

 * keywords:  has-patch needs-testing => has-patch needs-refresh


Comment:

 :wave: @jeremyfelt. First time looking into this, not sure the patch would
 solve the issue.

 If I'm not wrong, in the split view `WP_Text_Diff_Renderer_Table` prints
 out 3 columns. Using two `<th colspan='2'>` would mismatch the columns
 count (4 vs. 3). However, seems to me this is not the only problem.
 Depending on the combination of the arguments, the table markup can be
 invalid in other cases too.

 For example, when at least one of `title_left` or `title_right` is set,
 the `<thead>` element will contain 4 columns.

 Also, empty `<th>` should be avoided: table headers are used to give table
 columns their name and can't be empty. Empty columns used only for spacing
 should be avoided as well. This is not just for the sake of proper markup,
 it's also because assistive technologies will announce to users incorrect
 information.

 In the Revisions page, the table should have `<th>` headers, as there's no
 information about what the left and right column are about.

 Overall, there's room for some good improvements. They require some
 refactoring. I've started working at a patch, hope to have some time in
 the next days to upload a first pass.

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


More information about the wp-trac mailing list