Skip to content

Table's figcaption/caption elements are not persisted when pasted into the editor #30876

Open
@codebymikey

Description

Description

When pasting raw HTML into the editor, the figcaption element isn't properly persisted.

This appears to be because the figure element isn't included when pasted in the first place, and this piece of code should have logic in place which attempts to move figcaptions into a figure element if one does exist.

Step-by-step reproduction instructions

  1. Copy following HTML into a tool like https://www.onlinehtmleditor.net/
  2. Copy and paste the formatted HTML into the Gutenberg editor
  3. The figcaption element is moved outside of the original figure element.

The behaviour is also replicable by pasting the formatted HTML into https://wordpress.org/gutenberg/

Expected behaviour

The figcaption should be present as a child of the figure.

Actual behaviour

The figcaption is without a parent and subsequently converted into a p tag.

WordPress information

  • WordPress version: "5.8.0"
  • Gutenberg version: "9.4.0"
  • Are all plugins except Gutenberg deactivated? "Yes"
  • Are you using a default theme (e.g. Twenty Twenty-One)? "Yes"

Device information

  • Device: "Desktop"
  • Operating system: "Windows 10"
  • Browser: "Chrome 86.0"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

[Block] TableAffects the Table Block[Feature] Paste[Package] Blocks/packages/blocks[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[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