gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Consider adding text alignment support to the List block

Open richtabor opened this issue 3 years ago • 5 comments

What problem does this address?

While other text-related/content blocks support text alignment, the List block is omitted. Let's consider adding text alignment support to the List block, just like the Paragraph block supports.

Currently the only way to modify it's text alignment is to do so manually with a utility class.

CleanShot 2022-02-24 at 13 29 12@2x

richtabor avatar Feb 24 '22 18:02 richtabor

Should the number or bullet also be aligned?

carolinan avatar Jun 10 '22 14:06 carolinan

Cc @t-hamano

ellatrix avatar Jul 12 '24 14:07 ellatrix

If we just want a UI for applying text-align to the List block, the new textAlign support introduced in #59531 will do the trick. However, there is currently an issue that we cannot override alignments applied via the global styles from a block instance, as we are trying to solve in #62260.

Furthermore, textAlign doesn't take numbers and bullets into account, so we'll end up with something like this:

image

What is expected of this issue is to center the numbers and bullets left and right as shown below?

image

t-hamano avatar Jul 12 '24 14:07 t-hamano

Personally I would always expect the bullets to be in close proximity to the text, for the readability. So option two.

carolinan avatar Jul 16 '24 03:07 carolinan

So option two.

Achieving this would be difficult with block support. This is because, generally, if we want to center a list that includes bullets or numbers left and right, we need to apply display:inline-block to the list and text-align:center to the parent element.

By the way, this layout can also be achieved by wrapping the List block with a Row block with Justification set to center:

image

t-hamano avatar Jul 16 '24 06:07 t-hamano