-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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.
Description
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:
- it goes against the Styling guidelines, where classnames are generated at runtime
- hardcoded classnames can be effectively treated as public API, which can later need to involuntary breaking changes later on.
A/C
- Remove the
components-tools-panel
classname - Remove the
single-column
classname - Remove the
components-dropdown-menu
andcomponents-dropdown-menu__toggle
classnames
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.