-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add class to <ul> in List block. #12420
Copy link
Copy link
Closed
Labels
Good First IssueAn issue that's suitable for someone looking to contribute for the first timeAn issue that's suitable for someone looking to contribute for the first timeNeeds DecisionNeeds a decision to be actionable or relevantNeeds a decision to be actionable or relevant[Block] ListAffects the List BlockAffects the List Block[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.Questions or issues with incorporating or styling blocks in a theme.[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Metadata
Metadata
Assignees
Labels
Good First IssueAn issue that's suitable for someone looking to contribute for the first timeAn issue that's suitable for someone looking to contribute for the first timeNeeds DecisionNeeds a decision to be actionable or relevantNeeds a decision to be actionable or relevant[Block] ListAffects the List BlockAffects the List Block[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.Questions or issues with incorporating or styling blocks in a theme.[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Type
Fields
Give feedbackNo fields configured for issues without a type.
Is your feature request related to a problem? Please describe.
The subject of adding classes to default blocks was discussed at #6639, and I know you can filter the List block to add a new class, but the
wp-block-listclass should be present by default.Without a specific class, any style applied to the generic
<ul>will inadvertently affect elements from third-party plugins or custom HTML added elsewhere, and we can't know beforehand if they will be affected.One practical example happens when you try, for instance, to style the List block in a theme to add new bullets and you are also using the Elementor plugin.
Without a class, the generic
.ulstyle will affect<li>elements used by Elementor in their control handles – unless you explicitly filter the class or resort to a convoluted solution asul:not(.elementor-editor-element-settings):not(.wp-block-gallery):not(.wp-block-categories):not(.wp-block-latest-posts)... and so on.This will surely happen with lots of other plugins that use the
<ul>tag for tasks like this.Image 1: Custom style added to
<ul>tag.Image 2: Custom style affecting a third-party plugin.
Describe the solution you'd like
Just add the
wp-block-listclass to the<ul>tag by default, in the List block.Describe alternatives you've considered
:not()to the generic.ulstyle to target only the List block.Tested with 5.0-RC1-43946