-
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
Annotations: Merge assigned block className with incoming prop #21184
Conversation
Size Change: +18 B (0%) Total Size: 856 kB
ℹ️ View Unchanged
|
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.
Should we add a test? I'm fine either way.
@ellatrix From the original comment:
|
Fixes #21172
Related: #19514
This pull request seeks to resolve an issue in the implementation of annotations whereby it would replace the
className
assigned to the original component. This interfered with the changes introduced as of #19514 in that the.is-drop-target
class name was no longer being assigned.The changes here resolve this by merging any incoming
className
value to the assignedclassName
.Testing Instructions:
Repeat Steps to Reproduce from #21172, verifying the drop target appears when dragging a block.
As noted in #21172 (comment), this is most easily accomplished by enabling the "Gutenberg Test Plugin, Plugins API" plugin, assuming the default development environment is used.
Future Tasks:
There should be automated testing for this behavior. However, the implementation of annotations using
withSelect
is not easily tested without significant refactoring of the implementation itself (migrating to useuseSelect
hook and/or extracting common function for class name assignment). Since this may or may not need to be cherry-picked for WordPress 5.4, it would be best to save refactoring for future effort.cc @herregroen