Skip to content

Preview cards should not render Warnings or other interactive UIs that are not a preview #68131

@afercia

Description

@afercia

Description

Reported by @t-hamano on #67433 (comment)

The editor uses 'preview cards' in a few places. For example the list of Patterns 9In the inserter and other places) shows a 'card' with the pattern preview.

These previews are the actual rendering of the patterns. As such, they also render warnings and potentially other UIs that aren't really part of the preview.

For example, when a Pattern contains a block with invalid markup, it makes perfectly sense to show the Warning in the editing view. Screenshot:

Image

However, it doesn't make any sense showing the Warning in the card preview. Screenshot:

Image

Such a warning rendered there is hardly usable and I guess it also breaks the accessibility and semantics of the preview card.

Step-by-step reproduction instructions

  • Go to the Site editor > Patterns > and edit one of your custom patterns under 'My patterns'.
  • Switch the editor to the 'code' view and alter the markup to intentionally make one of the pattern's block invalid.
  • Switch the editor back to the 'visual' view.
  • Observe the editor renders the Block contains unexpected or invalid content. warning.
  • Click 'Open naavigation' at the toop left of the screen and go to 'My patterns'.
  • Observe the pattern card preview renders the Warning in the preview.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Package] Editor/packages/editor[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions