-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RichText should show placeholder again when content has been deleted and block is unfocused #5657
Comments
Bug still exists and is a major problem in my opinion. In the workflow of creating blocks I often backspace all the way to delete something and then retype different text. After saving and refreshing all the content is gone... |
@ktmn does this bug still exist? |
@iseulde Reproduction steps 1-5 are fixed, the placeholder returns if you delete everything with backspace. How ever the placeholder sometimes does not return when you select all the characters and hit delete. Not sure what's happening there, but it seems to work only every other time - type Reproduction steps 6-8 still happens with inline elements ( |
Where are we using that? RichText elements should never have an inline |
No, Gutenberg core doesn't afaik, but at the time of the report I was heavily using inline elements with RichText. It just felt the most appropriate tag to use for text content that wouldn't otherwise be wrapped with anything on the front end. It didn't yell at me so I never knew it was wrong. It works flawlessly until that bug showcases itself. A console warning or something would be nice I guess, so that other devs don't jump in that pitfall. |
Action item: warn if RichText is used with inline tag name. We should probably have a whitelist of tag names you can use. |
Closing in favour of #11839. |
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 valuea
.Steps to Reproduce (for bugs)
Add text...
placeholderasd
Doesn't get it's placeholder back because the editable still contains

(ZERO WIDTH NO-BREAK SPACE), but the RichText'sisEmpty()
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
The text was updated successfully, but these errors were encountered: