Skip to content

Add class to <ul> in List block.Β #12420

@pagelab

Description

@pagelab

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-list class 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 .ul style will affect <li> elements used by Elementor in their control handles – unless you explicitly filter the class or resort to a convoluted solution as ul: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

Image 2: Custom style affecting a third-party plugin.

image

Describe the solution you'd like
Just add the wp-block-list class to the <ul> tag by default, in the List block.

Describe alternatives you've considered

Tested with 5.0-RC1-43946

Metadata

Metadata

Assignees

Labels

Good First IssueAn issue that's suitable for someone looking to contribute for the first timeNeeds DecisionNeeds a decision to be actionable or relevant[Block] ListAffects the List Block[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Type] TaskIssues or PRs that have been broken down into an individual action to take

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions