ToolsPanel: move away from hardcoded classnames #35058
Labels
[Feature] Component System
WordPress component system
[Feature] UI Components
Impacts or related to the UI component system
[Package] Components
/packages/components
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
[Type] Enhancement
A suggestion for improvement.
What
Requires #34345 first, to make sure that tests don't rely on classnames.
We should refactor the
ToolsPanel
component so that it avoids using hardcoded classnames as much as possible.Currently, the hardcoded classnames in
TooolsPanel
are:components-tools-panel
. This class could be replaced by using the context system, so thatToolsPanelHeader
knows if it's being rendered inside aToolsPanel
single-column
. This class should be removed because it currently introduces circular dependencies with theblock-editor
andedit-site
(as also specified in Block Supports: Switch dimensions inspector controls slot to bubble virtually #34725 (review))components-base-control
as explained in Block Supports: Switch dimensions inspector controls slot to bubble virtually #34725 (comment)components-dropdown-menu
andcomponents-dropdown-menu__toggle
— these classnames are going to be tougher to remove, since they would need first theDropdownMenu
component to be refactored and use the new context System. After that, we could use the component's computed selector at runtime (example)Why
We should avoid using hardcoded classnames as much as possible in our components:
A/C
components-tools-panel
classnamesingle-column
classnamecomponents-dropdown-menu
andcomponents-dropdown-menu__toggle
classnamesThe text was updated successfully, but these errors were encountered: