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

Add text alignment controls to List block toolbar #6697

Closed
ZebulanStanphill opened this issue May 11, 2018 · 8 comments
Closed

Add text alignment controls to List block toolbar #6697

ZebulanStanphill opened this issue May 11, 2018 · 8 comments
Labels
[Feature] Blocks Overall functionality of blocks Good First Issue An issue that's suitable for someone looking to contribute for the first time

Comments

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented May 11, 2018

No way to align List blocks?

The Heading, Paragraph, and Subheading blocks all have text alignment controls in their block toolbars. (The Cover Image and Quote blocks do as well, but those blocks will soon be updated to use nested Paragraph and Heading blocks, so they do not really count.) For some reason, the List block currently lacks these controls.

Solution

Add the text alignment button controls to the block toolbar of the List block.

Related Issues and/or PRs

@karmatosed
Copy link
Member

I'm not sure also about adding these to list. What is your thinking of adding to list? I'll note as have in other issues maybe considering if something should have alignment is a good step over assuming it should in all blocks?

@ZebulanStanphill
Copy link
Member Author

ZebulanStanphill commented May 12, 2018

@karmatosed Well, you can text align Paragraph and Heading blocks, and List blocks are often intermixed with those, and it often looks weird to have a center-aligned Paragraph block followed by a left-aligned List block.

@karmatosed
Copy link
Member

I'm not convinced lists are the same treatment but if someone wants to work on a PR that's totally fine by me on this.

@ZebulanStanphill
Copy link
Member Author

@karmatosed

I just discovered that just using text-align: right on a List does not work how I expected it to:

image

I was envisioning the List to be placed on the right, but the list items would retain proper indentation. This is possible if you modify the HTML like so:

<div style="display: flex; justify-content: end">
	<ul>
		<li>sfasfsad
			<ul>
				<li>sdfsdf</li>
				<li>sfsdfs</li>
			</ul>
		</li>
		<li>sfsfsd</li>
	</ul>
</div>

That produces a list that looks like this:

image

Of course, this requires a wrapper <div> using display: flex and justify-content: end, so this is considerably more difficult to implement than I thought. It looks like the best way to have center or right-aligned lists is to use block alignment instead of text alignment.

So does this mean you should wrap the List block in something like the proposed Section block, or should block alignment tools be added to the List block?

@karmatosed
Copy link
Member

Whilst I understand what you are saying regarding having this as an option, what use do you think there is for this as a real use case?

2018-05-17 at 10 45

The above is what it looks like in the current editor for example.

@ZebulanStanphill
Copy link
Member Author

@karmatosed That’s what I realized… text alignment on a List block is pretty much useless. It is some sort of block alignment that I now realize is what I really wanted. Should open a new issue for that and close this one?

@karmatosed
Copy link
Member

karmatosed commented May 19, 2018

I am still unsure you need it for lists but not against it as an option if you feel there is a use case. I can't see one right now so would encourage thinking about that first. I am closing this as a result.

@gmfunk9
Copy link

gmfunk9 commented Oct 6, 2021

Client has been using "align center" on lists for many years now.
I'm attempting at remaking her site in a way she is used to using it

Adding text-align:center to my UL works perfectly, but it's not user-friendly in the Gutenberg editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks Good First Issue An issue that's suitable for someone looking to contribute for the first time
Projects
None yet
Development

No branches or pull requests

4 participants