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

Columns Block: Allow to Have One Column #24055

Closed
iamtakashi opened this issue Jul 20, 2020 · 6 comments · Fixed by #24065
Closed

Columns Block: Allow to Have One Column #24055

iamtakashi opened this issue Jul 20, 2020 · 6 comments · Fixed by #24065
Assignees
Labels
[Block] Columns Affects the Columns Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@iamtakashi
Copy link

iamtakashi commented Jul 20, 2020

I often need to make a design like this example where a heading spans across the wide width.

Frame 1

But adding a Heading block straight would result like this.

Frame 2

This is because the Heading block doesn’t have the width setting like other blocks at the moment. So I need to use the column block that is set to the wide width. And the minimum column number in the block is 2, so what I need to do in the end is to set one of the columns to 99% width, and the other to 1% so that the larger column would take most of the wide width.

Frame 3

While this gets the job kind of done, it’s really not ideal. Also, we see the empty column hanging around in the editor, and that's confusing for people who are editing the page. (I think I’ve seen this method was used in one of the block patterns in Gutenberg that had a large text saying “it’s time” at one point.)

There might be a better workaround or Gutenberg has already a better plan to accommodate this need, but otherwise, it could be a welcome addition to the block.

@richtabor
Copy link
Member

richtabor commented Jul 20, 2020

I agree. Typically I'd suggest using a Group block as essentially a single column block, though adding blocks within it can't always be aligned fullwidth/wide - which results in a frustrating experience trying to better align content within columns.

We found that folks use the single-column functionality in the CoBlocks Row block quite substantially.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 20, 2020
@mtias mtias added [Block] Columns Affects the Columns Block [Type] Enhancement A suggestion for improvement. labels Aug 26, 2020
@mtias
Copy link
Member

mtias commented Aug 26, 2020

Agreed! These micro-annoyances are fairly evident in the site editing context where you don't want to be constrained by the main column width all the time. I think working with a single column is a fine approach given the current limitations, but I'd love to arrive at better layout support that doesn't require so many hops and theme support.

cc @nosolosw @youknowriad @ellatrix @jorgefilipecosta for past conversations about similar issues.

@kjellr
Copy link
Contributor

kjellr commented Oct 2, 2020

@melchoyce opened this similar issue recently. Same result, but different tactic: #25655

@kjellr kjellr added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Oct 2, 2020
@youknowriad
Copy link
Contributor

It seems the Group block should be the solution for this but the fact that the group block has a "centered" area by default prevents it from being used to achieve that example above.

We've discussed several times with @jasmussen that the group block, by default, shouldn't have the "centered" area, basically, blocks inside it should expand their width automatically (like divs inside divs). But this only works if the inner blocks inside that particular group block forbid things like "wide" and "full" alignment as they don't make sense anymore.

We've also discussed this but the solution seems related to how a "container" block (or InnerBlocks) define the allowed alignments inside it, I see these things

  • A column block should probably forbid all alignments inside it by default
  • A group block instance could say: by default blocks are centered by I do offer wide and full alignments
  • Another group block instance (default behavior) could forbid wide alignments inside it and have its content expand automatically.

Now, the question becomes about API, what does an API to define supported alignments in InnerBlocks and the default alignment applied to these blocks look like? And how to style these alignments properly (Wide inside a single column layout could have a different style from "wide" inside a two columns layout and the editor should be able to do both at the same time, so how to "declaratively" generate these styles)?

@jasmussen
Copy link
Contributor

I think working with a single column is a fine approach given the current limitations, but I'd love to arrive at better layout support that doesn't require so many hops and theme support.

It seems the Group block should be the solution for this but the fact that the group block has a "centered" area by default prevents it from being used to achieve that example above.

These two separate statements both get at the core issue: it's weird that you can't use the group for this, but since that's the case, allowing a single column in the columns block could be a nice holdover.

I would add my support to both those statements, if enabling a single column in the columns block unlocks good things, go for it. But at the same time, the Group feels the right tool for this.

A group block instance could say: by default blocks are centered by I do offer wide and full alignments

I think this is smart. I'd like a "dumb group" by default, but I'd be fine with having an option on a full-wide group block to toggle a centered column inside.

@talldan
Copy link
Contributor

talldan commented Oct 6, 2020

A column block should probably forbid all alignments inside it by default

Just to add some weight behind this kind of API, there's a similar use case in the navigation block where Social Links can be set to full width inside the Navigation block (which also has alignment settings) - #25016 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Columns Affects the Columns Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
8 participants