WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

#41386 closed enhancement (fixed)

Text Widget - Wording - Legacy Mode 4.8.1 beta

Reported by: fullworks Owned by: westonruter
Milestone: 4.8.1 Priority: normal
Severity: normal Version: 4.8
Component: Widgets Keywords: has-patch commit fixed-major
Focuses: Cc:

Description

The text widget has legacy mode processing. On upgrade from 4.7 to 4.8.1 beta 1 the widget correctly detects legacy mode.

However, if the widgets is then edited to no longer contain html and has add paras checked ( i.e. edited to a mode the new text widget would on a fresh install operate in non legacy mode ) the wording continues to say 'may contain code' - when it no longer does. Looking forward this message could be confusing when it has been forgotten it used to contain code.

Solutions:
1 simple - change the wording e.g. 'may contain, or previously may have contained' ...
( the HTML widget won't be new forever either - so maybe there is a road map for this message ... )
2 complex - once code has been removed & filter set to automatically have paragraphs to remove legacy mode

http://badlywired.com/wp-content/uploads/2017/05/481.jpg

Attachments (1)

41386.patch (1019 bytes) - added by gk.loveweb 4 months ago.
Removed 'new' word.

Download all attachments as: .zip

Change History (15)

#1 follow-up: @westonruter
4 months ago

  • Milestone changed from Awaiting Review to 4.8.1
  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 4.8

@fullworks thanks for the feedback.

1 simple - change the wording e.g. 'may contain, or previously may have contained' ...

In the original patch it said “contains” but it changes to “may contain” in [41070]. @melchoyce do you think we should more explicit with the language?

( the HTML widget won't be new forever either - so maybe there is a road map for this message ... )

The Custom HTML widget actually will be around forever. I mean, it is not a temporary solution. There was a Custom HTML block added to the Gutenberg editor as well, so the idea isn't going away.

2 complex - once code has been removed & filter set to automatically have paragraphs to remove legacy mode

This was considered, actually, and discussed in #40951 (comment 147). In short, there would be a lot of complexity to dynamically upgrade widgets from the legacy mode when the content becomes eligible. There could be added complications if this was done as well, as if someone removed some code that triggered legacy mode so that the legacy mode was removed, if later then they tried re-adding the same triggering code, then the widget would break. It's safer just to keep it in legacy mode permanently.

#2 in reply to: ↑ 1 @fullworks
4 months ago

Replying to westonruter:

@fullworks thanks for the feedback.

( the HTML widget won't be new forever either - so maybe there is a road map for this message ... )

The Custom HTML widget actually will be around forever. I mean, it is not a temporary solution. There was a Custom HTML block added to the Gutenberg editor as well, so the idea isn't going away.

You might have misread my point - was saying it won't be new forever i.e. in 4.8.2 it won't be the new HTML widget - so suggesting that the wording that says the 'new' HTML widget in the future should say 'the HTML widget' and by WordPress 10.10 no message at all :)

Just an observation.

p.s. I tested all the way through 4.7.9 -> 4.8 -> 4.8.1 with and without my add-paragraphs... plugin and all my use cases worked fine and have already released an update so that in 4.8.1 my plugin does nothing as legacy mode sorts the issue.

#3 follow-up: @westonruter
4 months ago

@fullworks thanks very much for testing and giving it a ✅

You might have misread my point - was saying it won't be new forever i.e. in 4.8.2 it won't be the new HTML widget - so suggesting that the wording that says the 'new' HTML widget in the future should say 'the HTML widget' and by WordPress 10.10 no message at all :)

Ah yes, I did misunderstand. Yes, the word “new” should be removed in trunk so that it is gone when 4.9 comes out. This was actually mentioned previously but hasn't been actioned yet. Thanks for the reminder.

@gk.loveweb
4 months ago

Removed 'new' word.

#4 in reply to: ↑ 3 @gk.loveweb
4 months ago

Replying to westonruter:

Ah yes, I did misunderstand. Yes, the word “new” should be removed in trunk so that it is gone when 4.9 comes out. This was actually mentioned previously but hasn't been actioned yet. Thanks for the reminder.

Please check my patch above, kindly suggest if any changes are required.

#5 @westonruter
4 months ago

  • Keywords needs-patch added

@gk.loveweb There are two strings in the pointers as well, including:

Hey, did you hear we have a “Custom HTML” widget now?

I'm not sure how those should be re-worded for future releases.

#6 @melchoyce
4 months ago

Do we have any way of knowing whether the widget has been updated? So, before editing, you'd see the existing message, but after editing, we could show an updated message?

#7 @westonruter
4 months ago

@melchoyce that's a good point. In fact yes! The legacy property would get set after the first time the widget was updated. So we could have two separate messages.

#8 follow-up: @westonruter
4 months ago

@melchoyce the initial message could say “may contain” whereas after it could say “may have contained”? Note the updated message would only show the next time the user reloaded the page, with something like the following:

<div class="notice inline notice-info notice-alt">
        <?php if ( $created_since_48 ) : ?>
                <p><?php _e( 'This widget may have contained code that may work better in the new &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
        <?php else : ?>
                <p><?php _e( 'This widget may contain code that may work better in the new &#8220;Custom HTML&#8221; widget. How about trying that widget instead?' ); ?></p>
        <?php endif; ?>
</div>

#9 @melchoyce
4 months ago

@westonruter Seems good 👍

In the "may have contained" version, do you think it would make sense to replace:

How about trying that widget instead?

With:

If you haven't yet, how about trying that widget instead?

Or is that overkill?

#10 @westonruter
4 months ago

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

@melchoyce sounds good to me. I'll update the patch with that once #41394 is committed, as we'll be able to use $instance['visual'] to detect if the user has saved the widget in legacy mode.

#11 in reply to: ↑ 8 @westonruter
4 months ago

  • Keywords has-patch commit added; needs-patch removed

Replying to westonruter:

Note the updated message would only show the next time the user reloaded the page

Actually, this only applies to the widget in the Customizer. The notice in the widget on the admin screen will update right away.

#12 @westonruter
4 months ago

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

In 41134:

Widgets: Improve notice in Text widget's legacy mode.

Also fixes phpunit test which broke in [41132].

Props melchoyce, westonruter, gk.loveweb.
See #41394, #35243, #40951, #40907.
Fixes #41386.

#13 @westonruter
4 months ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening for 4.8.1.

#14 @westonruter
4 months ago

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

In 41135:

Widgets: Improve notice in Text widget's legacy mode.

Retains 'new' in notice on 4.8 branch, in contrast with [41134]. Also fixes phpunit test which broke in [41132].

Merges [41134] onto 4.8 branch.
Props melchoyce, westonruter.
See #41394, #35243, #40951, #40907.
Fixes #41386 for 4.8.1.

Note: See TracTickets for help on using tickets.