Skip to content

Allowable tags gettings stripped from Header blocks when drafts are auto-saved #5876

Closed

Description

Issue Overview

I wanted to add a header, with part of the text being enclosed in a <span></span> tag. When I tried to add the span tag in the Visual Editor, it simply escaped the angle brackets (which was expected).

I then switched to the Code Editor, added in the span tags to my Headers and saved my draft

gutenberg_headerwithspan1

When I viewed the page on the front-end, the headers included my span tags as expected.

I then wanted to edit the span tags but now, every time it auto-saves, it removes my span tags.

gutenberg_headerwithspan2

Steps to Reproduce (for bugs)

  1. Create new page
  2. Add several Header blocks
  3. Switch to Code Editor
  4. Edit the Header blocks by adding some text within a span tag (e.g. <span>some text</span>)
  5. Save draft
  6. Switch to back Visual Editor
  7. Preview page and verify span tags exist in headers
  8. Switch to Code Editor again
  9. Add span tags to Header blocks again (as content has been stripped by the switch back to the Code Editor)
  10. As soon as the page auto-saves, it strips the span tags

Expected Behavior

Allowable tags such as <span></span> shouldn't be stripped when in the Code Editor either when saving or auto-saving

Current Behavior

Strips allowable tags

Gutenberg 2.5.0
Firefox Quantum 59.0.2 (64-bit)
WP 4.9.4

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions