gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Consider giving blocks that support wide/full width a dedicated attribute/class

Open wwdes opened this issue 5 years ago • 1 comments

What problem does this address?

Let me explain,

I configure my themes so that blocks that do not support wide/full modes simply take up 100% possible width of its parent block. If such block has no parent block then it uses default width. It look's like this:

.wp-block[data-align] .wp-block:not([data-align]) { max-width: 100%; }

Because of this I need a huge CSS selector that instructs blocks that support wide/full width and are children to another block to default to default width. This is how this selector looks like:

:not([data-align]) > .wp-block-group, :not([data-align]) > .wp-block-cover, :not([data-align]) > .wp-block-columns, :not([data-align]) > .wp-block-image, :not([data-align]) > .wp-block-gallery, :not([data-align]) > .wp-block-table, :not([data-align]) > .wp-block-audio, :not([data-align]) > .wp-block-video, :not([data-align]) > .wp-block-embed, :not([data-align]) > .wp-block-pullquote, :not([data-align]) > .wp-block-categories, :not([data-align]) > .wp-block-separator, :not([data-align]) > .wp-block-navigation, :not([data-align]) > .wp-block-archives, :not([data-align]) > .wp-block-calendar, :not([data-align]) > .wp-block-latest-comments, :not([data-align]) > .wp-block-latest-posts, :not([data-align]) > .wp-block-rss :not([data-align]) > .wp-block-tag-cloud, :not([data-align]) > .wp-block-separator { max-width: var(--content-width)!important; }

This selector will grow as more blocks are added to gutenberg and any third party blocks will also need to be added.

What is your proposed solution?

Implement a new attribute or class for blocks that support wide/full widths so they can be selected with css.

wwdes avatar Apr 16 '21 22:04 wwdes

Closing as superseded by the layout engine: with constrained layouts, child width handling (default/wide/full) is generated automatically per container, so themes no longer need to hand-write width rules keyed to which blocks support alignments — the scenario this classname was meant to help with.

youknowriad avatar Sep 04 '26 08:09 youknowriad