Block Title: remove truncate discrimination#39416
Merged
Merged
Conversation
The consequence is that all block titles will be truncated, including core block title metadata. We're also adding unit tests that test the priority of block labels.
|
Size Change: -3 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
8 tasks
gziolo
approved these changes
Mar 14, 2022
gziolo
left a comment
Member
There was a problem hiding this comment.
Code changes look great and all updates to the documentation are excellent 👍🏻
Member
Author
|
The failing e2e tests are from a known issue in WordPress core (https://core.trac.wordpress.org/ticket/55367). @talldan Would you mind merging when you get a chance? 🙇 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR truncates all block labels/titles returned from the BlockTitle hook, where a
maximumLengthprop is passed.The consequence is that all block titles will be truncated, including core block title metadata.
We're also adding unit tests that test the priority of block labels.
Finally, I've updated the documentation to recommend against longer block titles as advised in #39110 (comment)
Why?
Previously only contextual block labels such as reusable block labels or block variation were truncated.
@gziolo rightly posed the question:
#39110 (comment)
How?
Calling
truncate()where amaximumLengthis passed.Testing Instructions
Block titles appearing in the Editor Breadcrumb (at the bottom), Block settings Dropdowns, List view labels and Block Toolbar labels should appear as expected.
A really really really long name that doesn't really mean much but might be truncated if it all some time if we happen to care