-
Notifications
You must be signed in to change notification settings - Fork 4.8k
ToolsPanel: move away from hardcoded classnames #35058
Copy link
Copy link
Closed
Labels
[Feature] Component SystemWordPress component systemWordPress component system[Feature] UI ComponentsImpacts or related to the UI component systemImpacts or related to the UI component system[Package] Components/packages/components/packages/components[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Metadata
Metadata
Assignees
Labels
[Feature] Component SystemWordPress component systemWordPress component system[Feature] UI ComponentsImpacts or related to the UI component systemImpacts or related to the UI component system[Package] Components/packages/components/packages/components[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.
What
Requires #34345 first, to make sure that tests don't rely on classnames.
We should refactor the
ToolsPanelcomponent so that it avoids using hardcoded classnames as much as possible.Currently, the hardcoded classnames in
TooolsPanelare:components-tools-panel. This class could be replaced by using the context system, so thatToolsPanelHeaderknows if it's being rendered inside aToolsPanelsingle-column. This class should be removed because it currently introduces circular dependencies with theblock-editorandedit-site(as also specified in Block Supports: Switch dimensions inspector controls slot to bubble virtually #34725 (review))components-base-controlas explained in Block Supports: Switch dimensions inspector controls slot to bubble virtually #34725 (comment)components-dropdown-menuandcomponents-dropdown-menu__toggle— these classnames are going to be tougher to remove, since they would need first theDropdownMenucomponent 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-panelclassnamesingle-columnclassnamecomponents-dropdown-menuandcomponents-dropdown-menu__toggleclassnames