Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#54140 closed defect (bug) (fixed)

Display is broken when wp_text_diff() is used in the admin screen

Reported by: mt8biz's profile mt8.biz Owned by: joedolson's profile joedolson
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.7
Component: Revisions Keywords: has-patch commit
Focuses: ui, css, administration Cc:

Description

If I use the following code, the output will be different between 5.6.5 and later versions.

<?php

add_action( 'wp_dashboard_setup', function () {
        wp_add_dashboard_widget(
        'wp_text_diff_test',
        'Test of wp_text_diff()',
        function() {
            print wp_text_diff( 'a' , 'b' );
        } 
    );  
});

Attachments (5)

5.6.5.png (112.9 KB) - added by mt8.biz 3 years ago.
5.6.5
5.8.1.png (109.2 KB) - added by mt8.biz 3 years ago.
5.8.1
54140.patch (379 bytes) - added by mt8.biz 3 years ago.
patch for this issue
54140.png (22.4 KB) - added by Hareesh Pillai 3 years ago.
Attached patch looks good to me.
Revisions.png (29.3 KB) - added by mukesh27 3 years ago.
Patch does not affect revision screen.

Download all attachments as: .zip

Change History (12)

@mt8.biz
3 years ago

5.6.5

@mt8.biz
3 years ago

5.8.1

@mt8.biz
3 years ago

patch for this issue

#1 @mt8.biz
3 years ago

This problem is caused by the following commit, which removes $this->emptyLine() and no longer outputs an empty td.

https://github.com/WordPress/WordPress/commit/35aaaacc044c12e1b4c4a3cd3b90578a7e79a65e

The second of the td's had a CSS to make it 4% wide.

I suggest remove the CSS code in the patch as it is not needed.

#2 @mt8.biz
3 years ago

  • Component changed from General to Revisions
  • Focuses ui css administration added
  • Version set to 5.7

#3 @mt8.biz
3 years ago

Out put codes

5.6.5

<tr>
  <td class="diff-deletedline">
    <span aria-hidden="true" class="dashicons dashicons-minus"></span>
    <span class="screen-reader-text">Deleted: </span>a
  </td>
  <td>&nbsp;</td>
  <td class="diff-addedline">
    <span aria-hidden="true" class="dashicons dashicons-plus"></span>
    <span class="screen-reader-text">Added: </span>b
  </td>
</tr>

5.8.1

<tr>
  <td class="diff-deletedline">
    <span aria-hidden="true" class="dashicons dashicons-minus"></span>
    <span class="screen-reader-text">Deleted: </span>a
  </td>
  <td class="diff-addedline">
    <span aria-hidden="true" class="dashicons dashicons-plus"></span>
    <span class="screen-reader-text">Added: </span>b
  </td>
</tr>

#4 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.9

Introduced in [50034].

@Hareesh Pillai
3 years ago

Attached patch looks good to me.

@mukesh27
3 years ago

Patch does not affect revision screen.

#5 @sabernhardt
3 years ago

  • Keywords has-patch commit added

#6 @joedolson
3 years ago

  • Owner set to joedolson
  • Status changed from new to accepted

#7 @joedolson
3 years ago

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

In 51972:

Widgets: Remove unused CSS breaking wp_text_diff layout.

Remove CSS used in version of wp_text_diff prior to [50034]. Orphaned CSS breaks default layout of function output, but is overridden in the revisions screen.

Props mt8.biz, hareesh-pillai, mukesh27.
Fixes #54140.

Note: See TracTickets for help on using tickets.