Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchor/Link text potentially causing legacy widget to break closed state "no preview" representation in editor #35052

Closed
ts-mz opened this issue Sep 22, 2021 · 5 comments
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.

Comments

@ts-mz
Copy link

ts-mz commented Sep 22, 2021

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=&quot;de-DE&quot;> <head>...

Step-by-step reproduction instructions

  1. Create a custom legacy widget/class for which no preview rendering is possible
  2. Have it output an anchor link with text
  3. See the closed legacy widget representation disappear

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

@annezazu annezazu added [Block] Legacy Widget Affects the Legacy Widget Block - used for displaying Classic Widgets Needs Technical Feedback Needs testing from a developer perspective. labels Sep 29, 2021
@annezazu
Copy link
Contributor

cc @getdave in case you have any insights :)

@annezazu annezazu added the [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) label Sep 29, 2021
@getdave
Copy link
Contributor

getdave commented Sep 30, 2021

👍 I think perhaps @noisysocks would be better placed to look into this one.

Also I'm not sure this is a Link Editing issue. I'm almost sure it will be specific to the Widgets editor. Remove label for now but can be re-added by @noisysocks if he feels I'm wrong.

@getdave getdave removed the [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) label Sep 30, 2021
@noisysocks
Copy link
Member

Could you please share a screenshot of what you're seeing? I'm not quire sure what you mean by "the closed legacy widget representation".

Also, could you please share the PHP code for the the custom widget that you're using for testing?

The "No preview available." message appears when the widget renders empty markup. <a href="#"></a> would be considered empty and <a href="#">foo</a> would be considered not empty.

@noisysocks noisysocks added the [Status] Needs More Info Follow-up required in order to be actionable. label Oct 1, 2021
@github-actions
Copy link

Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Oct 17, 2021
@devinmaeztri
Copy link
Member

Hi! I'm closing this issue as the author @ts-mz hasn't responded in 2+ weeks. It can be reopened when needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

5 participants