Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styles: audit utility classes generated on the frontend #41993

Closed
ramonjd opened this issue Jun 28, 2022 · 7 comments
Closed

Styles: audit utility classes generated on the frontend #41993

ramonjd opened this issue Jun 28, 2022 · 7 comments
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@ramonjd
Copy link
Member

ramonjd commented Jun 28, 2022

For auditing and to kick off a discussion, here is a (probably incomplete) list of styles Gutenberg generates for frontend code:

Classname Variations Description Status
is-${ orientation } vertical, horizontal layout current
is-content-justification-${ justification } center, left, right layout current
is-nowrap - layout current
is-layout-${ layout } flex, flow constrained layout current updated
has-background - block supports current
has-${ preset }-background-color Any color preset slug block supports current
has-${ preset }-gradient-background Any gradient preset slug block supports current
has-border-color - block supports current
has-${ preset }-border-color Any color preset slug block supports current
has-${ preset }-font-size Any font size preset slug block supports current
has-${ preset }-font-family Any font family preset slug block supports current
has-text-color - block supports current
has-${ preset }-color Any color preset slug block supports current
has-text-align-${ alignment } center, left, right text blocks current
has-inline-color text blocks
has-${ spacing }-spacing-size Any spacing preset slug block supports current
has-icon - icon current
wp-elements-${ unique_id } ${ element_tag } Unique id + element tag name selector, e.g., .wp-elements-123 a block supports current
wp-container-${ unique_id } Unique id layout current
wp-duotone-${ filter_id } img The id is a reference to the duotone filter id block supports current
wp-block-${ block_name } The block name without core/ prefix blocks current
wp-site-blocks - template wrapper current
wp-element-caption - elements current
wp-element-button - elements current

cc @apeatling @mtias

@ramonjd ramonjd added [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues CSS Styling Related to editor and front end styles, CSS-specific issues. [Type] Discussion For issues that are high-level and not yet ready to implement. labels Jun 28, 2022
@ramonjd
Copy link
Member Author

ramonjd commented Jun 30, 2022

An issue that raises the possibility for is-row etc for manifestations of the Group block

@andrewserong
Copy link
Contributor

One of the ideas in #39336 from @cbirdsong is to use .is-layout-row and .is-layout-stack classes for the horizontal and vertical variations of the flex layout type. So if we went that route, someone could potentially target a Row group block variation via .wp-block-group.is-layout-row?

@carolinan
Copy link
Contributor

This list is missing has-link-color, is there a reason?

@annezazu annezazu added [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. and removed [Type] Discussion For issues that are high-level and not yet ready to implement. labels Mar 21, 2024
@ramonjd
Copy link
Member Author

ramonjd commented Mar 21, 2024

Closing as stale.

The list needs refreshing. We can return when there's progress on classnames

@ramonjd ramonjd closed this as completed Mar 21, 2024
@yratof
Copy link

yratof commented May 6, 2024

Is there an out of the box standard for things like 'is-vertical'? just a utility css for all the flex layouts

@ramonjd
Copy link
Member Author

ramonjd commented May 6, 2024

I noticed there is a is-vertical classname added to stacked containers, e.g.,

<div class="wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-1 wp-block-group-is-layout-flex">
<p>Test</p>
</div>

But it doesn't have any corresponding CSS.

Looks like the classname is there for backwards compatibility:

$class_names[] = 'is-' . sanitize_title( $block['attrs']['layout']['orientation'] );

@cbirdsong
Copy link

I used this as a jumping off point for a discussion:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Type] Overview Comprehensive, high level view of an area of focus often with multiple tracking issues [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

6 participants