-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Editor: Remove legacy "editor-" class name compatibility #19050
Conversation
Was there a dev note when the new class was introduced? |
When they were introduced, it was the expectation that existing code would continue to work without any revisions, so a devnote wasn't deemed as being necessary. Since there could be revisions necessary as a result of this pull request, I've flagged it "Needs Dev Note" based on guidance from the backward compatibility document. |
Actually we wrote a global dev note about it even when we introduced them (editor to block-editor). A new one is needed as well. |
Aha! I must have forgotten about this, but you're correct: https://make.wordpress.org/core/2019/04/09/the-block-editor-javascript-module-in-5-2/
|
I've noticed that a lot of the default themes still reference many of the old class names. @mapk Do you have any suggestions on how we'd want to address this? I could open a Trac ticket for the themes to be updated. I'm not sure how that works with respect to if and how theme updates apply for older versions of WordPress (i.e. since these I think this might explain some of the visual oddities I've been observing when using recent versions of Gutenberg with default themes. At worst, it's something where we could revert the changes (and in #19489) until we figure out a better solution. But this puts us at odds with our own guidelines and kicks the can further down the road. |
Related: #18499
Effectively reverts #14420
This pull request seeks to remove the
editor-
-prefixed legacy className compatibility. These were added in #14420 as a result of a migration of components from the@wordpress/editor
to@wordpress/block-editor
package. With the changed in #14420, class names were changed to adhere to the CSS naming conventions, while retaining the previously-existingeditor-
prefixed names. As of #18499, a backwards-compatibility statement has been added, clarifying that these classes are not treated as a public interface intended for backwards-compatibility. As such, they are proposed to be removed here.This brings with it a few benefits:
editor-
prefix be included for the sake of consistency, even when it was not strictly necessary for backwards-compatibility.block-editor
bundle (331kb to 327kb minified, before gzip).Implementation Notes:
My process was as follows:
To find the legacy classes, I performed a regular expression search on the files of the
packages/block-editor
folder, using the pattern(?<!block-)editor-
. For each of these results, I manually verified and removed each compatibility class.Once all the changes had been made, I compiled a complete set of folders where files had been modified, to use as the "Base" of our BEM naming convention to perform a search on the entire repository for lingering references to the legacy class names:
This yielded many results where one of the following holds true:
block-editor
package (example). Note: I did not update these issues here.Testing Instructions:
Repeat testing instructions from #14420.