Skip to content

RichText should show placeholder again when content has been deleted and block is unfocused #5657

@ktmn

Description

@ktmn

Issue Overview

When removing all text from <wp.blocks.RichText> the placeholder does not reappear. After saving and reloading the page, it has a new value a .

Steps to Reproduce (for bugs)

  1. Add a core/button
  2. Click Add text... placeholder
  3. Type asd
  4. Hit backspace 3 times
  5. Unfocus the element

Doesn't get it's placeholder back because the editable still contains &#65279; (ZERO WIDTH NO-BREAK SPACE), but the RichText's isEmpty() checks if the container is completely empty.

Bonus:
6. Save the page.
7. Refresh the editor.
8. Button now has content: a.

Chrome 64.0.3282.186

Expected Behavior

Should put the placeholder back, not when all text is deleted, but after the block has lost focus.

Current Behavior

Possible Solution

Screenshots / Video

Related Issues and/or PRs

Todos

  • Tests
  • Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Rich TextRelated to the Rich Text component that allows developers to render a contenteditable[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions