-
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
List block - Cannot delete last empty list item #12787
Comments
Confirmed this also occurs in WordPress 5.1-alpha-43678 |
Can confirm this happens in WordPress 5.0.2, same desktop specs as OP. |
This also happens in custom blocks when using a multiline
Edit/Update: We resolved this for our custom elements by implementing a const removeEmptyTrailingItems = listItems => {
if ( listItems.length === 1 ) {
// Do not delete list entirely even if first element empty.
return listItems;
}
const lastItem = listItems[ listItems.length - 1 ];
if ( lastItem && lastItem.props && lastItem.props.children ) {
if ( lastItem.props.children.length === 0 ) {
// Recursively remove empty trailing list items.
return removeEmptyTrailingItems( listItems.slice( 0, -1 ) );
}
}
return listItems;
}; |
Can't reproduce this anymore. I suspect it was fixed by #13697. |
Thanks for testing! |
This issue has appeared again on my site |
Scenario to reproduce:
|
Related issue #14977 |
Describe the bug
I had a list block with an empty item as the last item. When I deleted the item the bullet disappeared. But the
<li></li>
tags didn't. So, after update, the empty item reappeared.Workarounds...
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The empty
<li></li>
should be deleted.Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: