Anchor/Link text potentially causing legacy widget to break closed state "no preview" representation in editor #35052
Labels
[Block] Legacy Widget
Affects the Legacy Widget Block - used for displaying Classic Widgets
Needs Technical Feedback
Needs testing from a developer perspective.
[Status] Needs More Info
Follow-up required in order to be actionable.
[Status] Stale
Gives the original author opportunity to update before closing. Can be reopened as needed.
Description
Note bene: I have tried this with the custom legacy example "foo" widget from the Codex, and could not reproduce the error, because the preview of the title is rendered fine upon saving.
That said, I have a custom legacy widget class that displays well in both open and closed state in the new widget editor unless there is an Anchor/Link with text present in the $output variable of the legacy widget. It doesn't matter if the code is actually echoed out or not.
$output = '<a href="abc.com"></a>';
will work fine, while
$output = '<a href="abc.com">xyz</a>';
will cause the closed state represenation of the legacy widget visually disappear in the editor. It is still clickable, and the open state is still completely functional.
In other words the no-preview-representation
<div class="wp-block-legacy-widget__edit-no-preview"> <h3>Widget Name</h3> <p>No preview available.</p> </div>
is not rendered in the source code. Instead apparently the entire frontend is loaded as an iframe into
<div class="wp-block-legacy-widget__edit-preview"> <div class="components-disabled css-u2jump e1ac3xxk0"> <iframe class="wp-block-legacy-widget__edit-preview-iframe" tabindex="-1" title="Legacy Widget Preview" srcdoc=" <!doctype html> <html lang="de-DE"> <head>...
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Local xampp Install, php 7.3.5
latest released WP
latest released Gutenberg
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: