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

Flex Layout: Allow control over vertical alignment of children #35849

Closed
kjellr opened this issue Oct 21, 2021 · 10 comments
Closed

Flex Layout: Allow control over vertical alignment of children #35849

kjellr opened this issue Oct 21, 2021 · 10 comments
Labels
[Block] Group Affects the Group Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Layout Layout block support, its UI controls, and style output. [Type] Enhancement A suggestion for improvement.

Comments

@kjellr
Copy link
Contributor

kjellr commented Oct 21, 2021

The current flex layout controls allow us to specify the horizontal justification of child items:

Screen Shot 2021-10-21 at 2 51 15 PM

As a pair to that, we should have the ability to specify the vertical alignment of children too (align-items). We can probably reuse icons from the columns block:

Screen Shot 2021-10-21 at 2 54 34 PM

Related: #33687

@kjellr kjellr added [Type] Enhancement A suggestion for improvement. [Block] Group Affects the Group Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Oct 21, 2021
@tellthemachines
Copy link
Contributor

Do we want these controls in the sidebar, or is it enough to have them in the block toolbar?

Screen Shot 2022-09-28 at 11 14 28 am

Also, do we want them to be available for all blocks with flex layout? (I'm thinking of Navigation where these tools are currently disabled)

cc @WordPress/gutenberg-design

@jasmussen
Copy link
Contributor

I think @youknowriad asked some questions about an interface for this a while back, and in response we made this inspector mockup for container blocks (Figma):

Container

I would think presence in the inspector could be a baseline, but for some blocks we'd almost certainly surface them in the block toolbar as well, on a curation basis, such as the Row block:

Container row

There's a question on align-self properties for inner blocks. This needs a bit more time in the oven, but this could be the basic idea:

Inner group

In the case of the inspector controls, we would probably make good use of the ToolsPanel behavior of not showing many of these options by default, allowing you instead to add them from the menu.

@jasmussen
Copy link
Contributor

Sidenote on labels-only mode, that's a good opportunity to trim and revisit the verbiage for the labels, both to enhance glancability and toolbar-width. Instead of Change items justification, perhaps it could just be Justification, and instead of Change vertical alignment it could be reduced to Vertical alignment. What do you think?

@andrewserong andrewserong added the [Feature] Layout Layout block support, its UI controls, and style output. label Sep 29, 2022
@tellthemachines
Copy link
Contributor

In the case of the inspector controls, we would probably make good use of the ToolsPanel behavior of not showing many of these options by default, allowing you instead to add them from the menu.

This is another one for when we migrate Layout to ToolsPanel then 😄

Change items justification, perhaps it could just be Justification, and instead of Change vertical alignment it could be reduced to Vertical alignment. What do you think?

Yes, that would help! We should do something about Move up and down buttons too; would it be ok to make the buttons wider? I don't think we'd want the font size smaller than the current 12px otherwise it becomes unreadable.

@andrewserong
Copy link
Contributor

This is another one for when we migrate Layout to ToolsPanel then 😄

I think this would be great to do! I don't think we already have an issue for this particular task in isolation, so I've written it up in #44560 so that it can be picked up when the time is right 🙂

@jasmussen
Copy link
Contributor

Yes, that would help! We should do something about Move up and down buttons too; would it be ok to make the buttons wider? I don't think we'd want the font size smaller than the current 12px otherwise it becomes unreadable.

I'd like to think that the block toolbar itself could use a further refactor. Many of the items inside are abs-positioned and have fixed widths, I would imagine that we could move towards varous flex properties here instead. A flex-basis as wide as the icon button should be could potentially grow automatically for wider text.

@tellthemachines
Copy link
Contributor

A flex-basis as wide as the icon button should be could potentially grow automatically for wider text.

Agreed, it makes sense for the button to resize according to its contents!

@skorasaurus
Copy link
Member

Would love to see this customization as well since as of now, the row variation applies an inlinealign-items: center by default to its immediate children.

@tellthemachines
Copy link
Contributor

@skorasaurus there are already controls in the Row block toolbar to change the vertical alignment:

Screenshot 2023-03-09 at 3 20 36 pm

I also started a PR over in #47099 to remove the default alignment rules, but don't know how feasible that will be in terms of back compat.

It might be time to close this issue as the migration of layout to ToolsPanel is already tracked elsewhere 🤔

@andrewserong
Copy link
Contributor

It might be time to close this issue as the migration of layout to ToolsPanel is already tracked elsewhere 🤔

Agreed. We have an issue for that over in #44560, so I'll close out this one now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Group Affects the Group Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Layout Layout block support, its UI controls, and style output. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants