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

WordPress Trac noreply at wordpress.org
Tue May 21 15:33:33 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:  5.3
Component:  Revisions                  |     Version:  3.6.1
 Severity:  normal                     |  Resolution:
 Keywords:  has-patch has-screenshots  |     Focuses:  accessibility
---------------------------------------+----------------------------
Changes (by afercia):

 * keywords:  has-patch needs-refresh => has-patch has-screenshots
 * milestone:  Future Release => 5.3


Comment:

 [attachment:"25473.diff"] is a first pass. Some of the things I'd like to
 propose:

 In `wp_text_diff()`:
 - removes the empty table columns
 - removes the `<colgroup>` and `<col>` elements: they were used only for
 styling: replaced with a CSS class
 - if `$args['title']` is set, adds a table `<caption>` element
 - if `title_left` and `title_right` are set, adds table headers: if one of
 the two is empty, prints out an empty `<td>` element instead of an empty
 `<th>`
 - adds `show_split_view` to the default args


 In the Revisions page:
 - some of the previous changes are repeated for the extra, custom, table
 used in this page
 - fixes the headings (hierarchy was wrong, see screenshot)
 - adds new, visually hidden, heading and help text
 - makes the slider "handles" a bit more accessible

 Re: the table headers "Base revision" and "Compared revision": any
 suggestion for better wording and styling is welcome.

 For testing, I used this snippet:

 {{{
 echo wp_text_diff(
         'My nice string',
         'My changed string',
         array(
                 'show_split_view' => true,
                 'title'           => 'Table Caption',
                 'title_left'      => 'Left Title',
                 'title_right'     => 'Right Title'
         )
 );
 }}}

 Some testing would be nice. Please play with the parameters, change inline
 / split view, omit the title, etc. and check the table output is always
 valid, semantic markup.

 Moving to 5.3 consideration.

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


More information about the wp-trac mailing list