-
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
(editor)(fix) Append the edit-post-header-toolbar
class in NavigableToolbar for backward compatibility with plugin GUI injections
#58154
Conversation
…r` as some plugins use it to append GUIs to it
Size Change: -7.06 kB (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
edit-post-header-toolbar
class in NavigableToolbar for backward compatibility with plugin GUI injectionsedit-post-header-toolbar
class in NavigableToolbar for backward compatibility with plugin GUI injections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an inline comment, explaining why we're keeping this classname around (since the classname doesn't follow our naming guidelines)
Sure 👍🏻 |
The linked |
Done in f8a2780. |
…eToolbar for backward compatibility with plugin GUI injections (#58154) * Keep the `edit-post-header-toolbar` CSS class in the `NavigableToolbar` as some plugins use it to append GUIs to it * Add comment justifying the change
What?
Before Gutenberg 17.5, the
edit-post-header-toolbar
CSS class was hardcoded inNavigableToolbar
sclassName
, see #. This changeset then change the hardoded string to the following call:{ classnames( 'editor-document-tools', className) }
while not keeping the old class in the list.Why?
3rd party plugins might use that classname to select the element and inject GUIs there, like buttons. An example of that is Elementor. It uses the
edit-post-header-toolbar
CSS class to find the div it will append the#elementor-gutenberg-button-switch-mode
button to (see the line here). That div was hardcoded before the changes in #57214, but now uses the following expression:{ classnames( 'editor-document-tools', className ) }
to render its classname (see the diff here), which results incomponents-accessible-toolbar editor-document-tools is-unstyled
in the markup. TL;DR: Elementor can't find the elementHow?
By adding the
edit-post-header-toolbar
as one of the params of theclassnames
function call so that it will be rendered alongside them.Testing Instructions
Edit with elementor
button in the toolbar;trunk
, reload the editor;